Presentation is loading. Please wait.

Presentation is loading. Please wait.

More ISP At a Glance.

Similar presentations


Presentation on theme: "More ISP At a Glance."— Presentation transcript:

1 More ISP At a Glance

2 Outline Cloud Computing RoR Smart Phone Apps Node.js IoT Python Pearl

3 Cloud Computing

4 Cloud Computing Computing technology and infrastructure offered by vendors on demand. Based on virtualization techniques, hence offers the benefits of virtualization Services consumed based on pay per use model No up-front cost No commitment

5 Virtualization Multiple virtual servers run on a host hardware (a server, a server farm or a data center). Share hardware by dividing resources (CPUs, RAM, hard disks, network). A Virtual Machine (VM) is an isolated software container which runs its own operating systems and applications behaving like a physical computer. VMs reside on hypervisors which give direct access to the hardware

6 Virtualization OS1 OS2 OS40 VM1 VM2 VM40 Hypervisor Hardware

7 Virtualization Advantages
Cost-effective Less hardware and require less space. Reduce power consumption. Reduced server maintenance. Maximum resource utilization Flexibility VMs are independent of each other. Reconfigured, removed and restored easily. Highly available. Disaster recovery, server crashes and software upgrades by copying image files to another machines

8 Cloud Computing Services offered as
Software as a Service (SaaS) Web services, Google Apps Platform as a Service (PaaS) Microsoft Azure, Google App Engine Infrastructure as a Service (IaaS) Amazon’s Elastic Compute Cloud, Microsoft Azure VM role instance

9 Why Cloud Computing? Virtualization benefits No hardware requirements
Cost-effective, reliable, flexible and portable No hardware requirements Vendor worry about software upgrades and hardware failures Highly available Application installed in the cloud - data centers Access via internet browser Large-capacity storage and high performance computing Add resources on-demand, scalable

10 Cloud Vendors Microsoft Azure Platform Amazon
Windows Azure Compute and Storage SQL Azure Windows Azure AppFabric Amazon Elastic Compute Cloud Simple Storage Service Relational Database Service Elastic Load Balancing

11 Cloud Computing Salesforce.com

12 Introduction to RoR Ruby on Rails

13 Ruby Interpreted Dynamic data typing Object-oriented:
encapsulation Inheritance (code reuse by sub-classing) polymorphism Can run locally or on a server (Rails) .

14 Data Structures & Algorithms
Data Types: Scalars and Arrays Scalars: Numeric: Fixnum, Bignum, Float String Arrays: non-uniform Array: similar to C++, with sub-array operations and shift, unshift, push, pop Associative Array, Hash, key=>value, Similar to PHP. IS: Input: gets Output: puts .

15 Ruby in CS Labs Ruby is installed on CS lab computers.
Login onto a lab computer or one of the winremote computer. Start Cygwin You will be in a simulated Unix environment. Try the following Unix commands: ls, pwd, mkdir ruby, cd ruby, ruby –h, cp, rm, .

16 Ruby in CS Labs Start interactive ruby by typing irb line = gets
Go, ISP, GO puts line exit .

17 Data Structures & Algorithms
Operators/Controls no ++ or – gets/puts EOF for keyboard input: Ctrl-D (Unix/Mac), Crel-Z (PC) Case statement can be a right operand “for” loop is replaced by for-in for value in list puts value end .

18 Data Structures & Algorithms
Operators/Controls break/next 3 object comparisons: == (value) equal (reference) eql (type) .

19 Data Structures & Algorithms
UDT: class class Name .. end Class Name begins with upper case Instance name begins with lower case Constructor “new” calls initialize Classes are dynamic, can add members later. getter/setter .

20 Data Structures & Algorithms
UDT: class, Inheritance class Name < Parent .. end Support multiple inheritance .

21 Data Structures & Algorithms
Pattern Matching string =~ /pattern/ Substitutions str.sub(pattern, replacement) str.gsub(pattern, replacement) word_table.rb .

22 Data Structures & Algorithms
# word_table.rb from PWWW # Input: Text from the keyboard. All words in the input are # separated by white space or punctuation, possibly followed # by white space, where the punctuation can be a comma, a # semicolon, a question mark, an exclamation point, a period, # or a colon. # Output: A list of all unique words in the input, in alphabetical # order, along with their frequencies of occurrence .

23 Data Structures & Algorithms
# word_table.rb freq = Hash.new line_words = Array.new # Main loop to get and process lines of input text while line = gets # Split the line into words line_words = line.chomp.split( /[ \.,;:!\?]\s*/) .

24 Data Structures & Algorithms
# word_table.rb # Loop to count the words (either increment or initialize to 1) for word in line_words if freq.has_key?(word) then freq[word] = freq[word] + 1 else freq[word] = 1 end End .

25 Data Structures & Algorithms
# word_table.rb # Display the words and their frequencies puts "\n Word \t\t Frequency \n\n" for word in freq.keys.sort puts " #{word} \t\t #{freq[word]}" end .

26 Ruby References https://www.ruby-lang.org
.

27 Ruby Installation Download the current stable version
Needs download tools: PC: RubyInstaller Mac/Unix: rbenv and RVM Needs above to run Active Support .

28 . Rails

29 Rails Framework for developing Web applications.
A framework is a standardized system of reusable templates. Based on the MVC (Model-View-Controller) web application architecture. RoR (Ruby on Rails) uses predefined M,V,C classes (in Ruby) to form the templates. .

30 Rails MVC Architecture (PWWW)
.

31 Architecture of a Four-Tier Application
DBMS / Database Server Application Server WEB S E R V C L I N T Database User Interface Database Engine Supporting Software Database API Application Logic App User Interface Wednesday 3/18/2015 day and evening Architecture of a Four-Tier Application

32 Architecture of RoR Web Applications
DBMS / Database Server RoR Web Applications WEBrick or any Web Server on the same system. Web C L I E N T Database User Interface Database Engine Supporting Software Database API (Model:ORM) Application Logic (Controller) App User Interface (View) Wednesday 3/18/2015 day and evening Architecture of RoR Web Applications

33 . Installing Rails

34 Rails Installation Rails comes with Ruby along with RubyGems
PWWW uses SQLite3 (SQLite.org) for database Command line installations gem install sqlite3 gem install rails Or sudo gem install sqlite3 sudo gem install rails .

35 Rails Server Startup Start the webrick server (came with Rails)
rails server webrick URL to access the server .

36 Rails Hosting http://www.railshosting.org/free-rails-hosting
host-comparison-aws-digitalocean-heroku- engineyard Detailed instructions on using Amazon AWS Cloud: and-j2ee-app-deployment.jsp .

37 . Programming RoR Day

38 RoR Web Application Development
Automatically generates web apps Apps are composed of MVC classes Similar to our PA5 but without GUI, everything is Command Line .

39 RoR Web Application Development A “Hello World” Example
.

40 Architecture of RoR Web Applications
DBMS / Database Server RoR Web Applications WEBrick or any Web Server on the same system. Web C L I E N T Database User Interface Database Engine Supporting Software Database API (Model:ORM) Application Logic (Controller) App User Interface (View) Wednesday 3/18/2015 day and evening Architecture of RoR Web Applications

41 Programming RoR: Examples
>rails new greet .

42 Greet Example >rails generate controller say hello
It generates the code for the controller class named “say” with a method named “hello”. say_controller.rb class SayController < ApplicationController def hello end .

43 Greet Example The same command also generated the code for the view
app/views/say/hello.html.erb Embedded Ruby <!DOCTYPE html> <!-- hello.html.erb - the template for the greet application --> <html lang = "en"> <head> <title> greet </title> <meta charset = "utf-8" /> </head> <body> <h1> Hello from Rails </h1> </body> </html .

44 Programming RoR: Examples
>rails new greet .

45 Dynamic response of the application server
to a user request 0. Web Client->HTTP Get->Webrick->Rails->App 1. Instantiate SayController class 2. Call the hello action method 3. Search the views/say directory for hello.html.erb 4. Process hello.html.erb with Erb 5. Return the resulting hello.html to the requesting browser

46 Greet Example Customization
<!DOCTYPE html> <!-- hello.html.erb - the template for the greet application --> <html lang = "en"> <head> <title> greet </title> <meta charset = "utf-8" /> </head> <body> <h1> Hello from Rails </h1> It is now <%= t = Time.now %> <br /> Number of seconds since midnight: <%= t.hour * t.min * 60 + t.sec %> </body> </html .

47 RoR Web Application Development A 4-tier Enterprise Example
.

48 Architecture of RoR Web Applications
DBMS / Database Server RoR Web Applications WEBrick or any Web Server on the same system. Web C L I E N T Database User Interface Database Engine Supporting Software Database API (Model:ORM) Application Logic (Controller) App User Interface (View) Wednesday 3/18/2015 day and evening Architecture of RoR Web Applications

49 ORM (Object Relation Model)
We need to create a database for the enterprise application. The database is going to be relational. But we don’t have to define the schema using DDL. We will let Rails to do that for us. Rails will create a class to specify the schema: The name of the class (object model) is the singular of the relational table name. The name of the member variables are the names of the columns of the table. The member methods of the class are inherited from the ActiveRecord class. .

50 ORM (Object Relation Model)
Here are the implementation steps: Create the application >rails new cars (2) Create the class to define the schema (cars/db/migrate) >rails generate scaffold corvette body_style:string miles:float year:integer (3) Create the database table >rake db:migrate (4) The application, the controller, the view, are all automatically created without writing a single line of Ruby code! (Familiar? PA3) .

51 Programming RoR: Examples
.

52 Programming RoR: Examples
When clicking on “New corvette” .

53 Programming RoR: Examples
After entering a “New corvette” .

54 Programming RoR: Examples
UI for Editing .

55 Programming RoR: Examples
For Destroy .

56 Application? Recreate your Social List web application using RoR in 5 minutes without writing a single line of code! .

57 Creation? Convert your PA5 as the GUI of Rails commands for other programmers (?) to create similar applications! .

58 Programming Smart Phone Apps . Day

59 Android

60 Programming Using Android IDEs

61 Development Tools Android software are developed with IDEs (Integrated Development Environment). We will use Android Studio: You can also use Eclipse for Android developers: You also need two development toolkits: Java Development Kit (JDK) Android Development Toolkit (ADT) included in Android Studio and Eclipse for Android.

62 ANDROID STUDIO SETUP

63 Setup Android Studio Android studio : Download the dmg file and open it to install. Select standard installation. Start Android Studio. It may check and update latest Android SDK. For the very first time you run the application, you will be asked to select a screen configuration.

64 Setup Android Studio

65 PROGRAMMING with android studio

66 Programming with Android Studio
Start Android Studio Import an Android code sample Select an existing sample (say, Universal Music Player). Update any components when asked to do so. Run->Run. Select Deployment Target Connected Devices or Virtual Devices It will automatically deploy the app to the device you selected and run it there.

67 Programming with Android Studio

68 DEPLOY ANDROID APP

69 Programming with Android Studio
You can also create build an APK file to distribute. Build->Build APK(s) Update any components when asked to do so. A prompt screen will show up when done building for you to locate and analyze the APK. C:\Users\xiao\AndroidStudioProjects\UniversalMusicPlayer\mobile\b uild\outputs\apk\mobile-debug.apk You can’t an APK file via gmail. But you can upload it to Google Drive and share a download link with others. On your phone, save the APK via the download link. The app will be automatically installed.

70 Vysor interacting with your phone on a computer

71 Vysor: interacting with your phone on a computer
To interact with your Android phone on a computer, download Vysor. You can download it for Windows, Mac, Linux or Chrome For windows, you also need to download ADB

72 Vysor: interacting with your phone on a computer
On your Android phone: Settings Develop options (if your don’t see the options, go to “About Phone”, click “Build number” several times until it says you are now a developer. :-). Turn on USB Debugging USB configuration: Select MTP (Media Transfer Protocol)

73 Vysor: interacting with your phone on a computer
Connect you phone to the computer’s USB port. You computer should automatically detects the phone and prompt you to start Vysor. If not, start Vysor youself. Select the device to view. If Vysor does not detect you device, do the following: Make sure your USB cable is the original data cable not just a charging cable. Restart you computer and restart your phone. If still not working, remove and reinstall Vysor and ADB.

74 Vysor

75 Android Architect

76 Architecture Evening

77 Sensors Overview The Android platform supports three broad categories of sensors: Motion sensors: these sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors. Environmental sensors: these sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers. Position sensors: these sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.

78 Android EDP CODING

79 Basic programming tasks:
Identifying sensors and sensor capabilities. Identify sensor events to monitor. Write handlers for them.

80 OOP: Classes

81 Sensor Framework The sensor framework is part of the android.Hardware package and includes the following classes and interfaces: Sensormanager You can use this class to create an instance of the sensor service. This class provides various methods for accessing and listing sensors, registering and unregistering sensor event listeners, and acquiring orientation information. This class also provides several sensor constants that are used to report sensor accuracy, set data acquisition rates, and calibrate sensors. Sensor You can use this class to create an instance of a specific sensor. This class provides various methods that let you determine a sensor's capabilities. Sensorevent The system uses this class to create a sensor event object, which provides information about a sensor event. A sensor event object includes the following information: the raw sensor data, the type of sensor that generated the event, the accuracy of the data, and the timestamp for the event. Sensoreventlistener You can use this interface to create two callback methods that receive notifications (sensor events) when sensor values change or when sensor accuracy changes.

82 Identifying sensors and sensor capabilities
Create an instance of the sensormanager class by calling the getsystemservice() method and passing in the sensor_service argument. We can determine whether A specific type of sensor exists on A device by using the getdefaultsensor() method and passing in the type constant for A specific sensor for example: private SensorManager mSensorManager; ... mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); if (mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null){ // Success! There's a Accelerometer. } else { // Failure! No Accelerometer. }

83 Monitoring Sensor Events
To monitor raw sensor data you need to implement two callback methods that are exposed through the sensoreventlistener interface: onaccuracychanged() and onsensorchanged() this methods are called whenever the following occurs: A sensor's accuracy changes. In this case the system invokes the onaccuracychanged() method, providing you with a reference to the sensor object that changed and the new accuracy of the sensor. Accuracy is represented by one of four status constants SENSOR_STATUS_ACCURACY_LOW, SENSOR_STATUS_ACCURACY_MEDIUM,SENSOR_STATUS_ACCURACY_HIGH, or SENSOR_STATUS_UNRELIABLE. A sensor reports a new value. In this case the system invokes the onsensorchanged() method, providing you with a sensorevent object. A sensorevent object contains information about the new sensor data, including: the accuracy of the data, the sensor that generated the data, the timestamp at which the data was generated, and the new data that the sensor recorded.

84 An example using Accelerometer
Accelerometer measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of gravity. This example uses the Accelerometer to roll a group of balls.

85 An example using Accelerometer
Accelerometer_Android Studio Project Directory \app\src\main\java\com\example\android\accelerometerplay AccelerometerPlayActivity.java Public void onsensorchange(sensorevent sensorevent) {     sensor mysensor = sensorevent.Sensor;     If (mysensor.Gettype() == sensor.Type_accelerometer) {         float x = sensorevent.Values[0];         Float y = sensorevent.Values[1];         Float z = sensorevent.Values[2];     } }

86 An example using Accelerometer
Accelerometer_Android Studio Project Directory \app\src\main\java\com\example\android\accelerometerplay AccelerometerPlayActivity.java Public void onsensorchange(sensorevent sensorevent) {     sensor mysensor = sensorevent.Sensor;     If (mysensor.Gettype() == sensor.Type_accelerometer) {         float x = sensorevent.Values[0];         Float y = sensorevent.Values[1];         Float z = sensorevent.Values[2];     } }

87 Map Example Start Android Studio Start a new project
Select the Map project from the examples Import anything it asks you Two files will be generated: google_map_api.xml MapsActivity.java Run->Run ‘app’ (the paly button). It will ask you create an emulator if you have not done so. Select a smart phone to emulate.

88 Map Example

89 Resources Resources are non-coding elements of the application
String resources (for Internationalization) Configuration resources (for GUI setting and DB connections) Get a Google Map key by following the instructions in google_map_api.xml Modify the google_maps_key. Run ‘app’ again. <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyD-eK-tf32qnGIS4RueDX09aG6EuyZclnE</string>

90 Resources

91 References accelerometer-on-android--mobile-22125 t/index.html acceleration.html

92 iOS App Development

93 iOS revealed with the first iPhone by Steve Jobs on January 9th, 2007
Overview iOS revealed with the first iPhone by Steve Jobs on January 9th, 2007 Brought multitouch to the masses iOS 2 - Introduced the App Store Currently over 2,000,000 iOS Apps App developers earned $20 billion in 2016

94 MVC Architecture This pattern separates the app’s data and business logic from the visual presentation of that data. This architecture is crucial to creating apps that can run on different devices with different screen sizes.

95 MVC Architecture Separates data and business logic from the visual presentation Support devices with different screen sizes. This pattern separates the app’s data and business logic from the visual presentation of that data. This architecture is crucial to creating apps that can run on different devices with different screen sizes.

96 Main Run Loop The main run loop executes on the app’s main thread.
Events are generated by the system. Events are queued and dispatched to the main run loop. The UIApplication object receives the event and makes decisions. An app’s main run loop processes all user-related events. The UIApplication object sets up the main run loop at launch time and uses it to process events and handle updates to view-based interfaces. The main run loop executes on the app’s main thread. This behavior ensures that user-related events are processed serially in the order in which they were received. As the user interacts with a device, events related to those interactions are generated by the system and delivered to the app via a special port set up by UIKit. Events are queued internally by the app and dispatched one-by-one to the main run loop for execution. The UIApplication object is the first object to receive the event and make the decision about what needs to be done. So, a touch event is usually dispatched to the main window object, which in turn dispatches it to the view in which the touch occurred. Other events might take slightly different paths through various app objects.

97 Execution States The system controls the app’s state.
Each transition calls a corresponding method that responds to the state change. The system moves your app from state to state in response to actions happening throughout the system. For example, when the user presses the Home button, a phone call comes in, or any of several other interruptions occurs, the currently running apps change state in response. Apps must be prepared for termination to happen at any time and should not wait to save user data or perform other critical tasks. System-initiated termination is a normal part of an app’s life cycle. The system usually terminates apps so that it can reclaim memory and make room for other apps being launched by the user, but the system may also terminate apps that are misbehaving. Suspended apps receive no notification when they are terminated; the system kills the process and reclaims the corresponding memory. If an app is currently running in the background and not suspended, the system calls the applicationWillTerminate: of its app delegate prior to termination. The system does not call this method when the device reboots

98 Developer Tools You will need: Apple ID with Developer Access
Mac with latest Xcode IDE Swift programming language Additionally: Tutorials: ettingStarted/DevelopiOSAppsSwift/ playgrounds/id ?mt=8 Unity3D.com

99 . Node.js Day

100 Node.js What: Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Where: How:

101 WebAssembly “WebAssembly (abbreviated Wasm [1]) is a safe, portable, low-level code format designed for efficient execution and compact representation. Its main goal is to enable high performance applications on the Web, but it does not make any Web-specific assumptions or provide Web-specific features, so it can be employed in other environments as well.” on.html virtual instruction set architecture (virtual ISA) WebAssembly application programming interface (API)

102 WebAssembly Architecture
Source Code for Language 1 Source Code for Language 2 Language 1 IDE on OS1 Language 2 IDE on OS2 WASM (vISA: virtual instruction set architecture) / LLVM-IR Web Server->Client Browser-> V8->Node.js WASM VM Binary Code for OS1 Binary Code for OS2 OS1 OS2

103 Node.js “Node.js is an open-source, cross- platform JavaScript run-time environment that executes JavaScript code outside of a browser.”

104 . IoT Day

105 IoT What: “The Internet of Things, or IoT, refers to the billions of physical devices around the world that are now connected to the internet, collecting and sharing data..” you-need-to-know-about-the-iot-right-now/ Where: How:

106 Python What: Interpretive Dynamic type OOP Local, Server Where: How:

107 . Perl Day

108 Perl What: “Practical Extraction and Reporting Language”, “Duct-tape of the Internet” Interpreted Dynamic typed OOP DBI Perl6 (Sister Language to Perl 5). Where: How:

109 Techniques for the above
What did we learn? Knowledge Comprehension Application Creation Techniques for the above .


Download ppt "More ISP At a Glance."

Similar presentations


Ads by Google