Basic Programming in Ruby Today’s Topics: Introduction last class irb history log Methods Classes (briefly) Using 3 rd Party Libraries rubygems ‘ require.

Slides:



Advertisements
Similar presentations
Implementing Tableau Server in an Enterprise Environment
Advertisements

Web Toolkit Julie George & Ronald Lopez 1. Requirements  Java SDK version 1.5 or later  Apache Ant is also necessary to run command line arguments 
CIS 4004: Web Based Information Technology Spring 2013
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
WebGoat & WebScarab “What is computer security for $1000 Alex?”
ANT: Another Nice Tool Ali Beyad October 1, 2003.
SQL Reporting Services Overview SSRS includes all the development and management pieces necessary to publish end user reports in  HTML  PDF 
Tomcat Celsina Bignoli History of Tomcat Tomcat is the result of the integration of two groups of developers. – JServ, an open source.
The New Books List Michael Doran, Systems Librarian Ex Libris Southwest Users Group February 6, 2008 – Santa Ana College.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 4 Manage Software for SUSE Linux Enterprise Server.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Software Engineering 2003 Jyrki Nummenmaa 1 CASE Tools CASE = Computer-Aided Software Engineering A set of tools to (optimally) assist in each.
Introduction to Internet Programming (Web Based Application)
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
Application Servers: Tomcat. What is an application server? Servlets are Java’s answer to server-side programming. Servlets are a special type of Java.
Ruby! Useful as a scripting language – script: A small program meant for one time use – Targeted towards small to medium size projects Use by: – Amazon,
1 Dr Alexiei Dingli Web Science Stream Advanced ROR.
Attacking Applications: SQL Injection & Buffer Overflows.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
Contents 1.Introduction, architecture 2.Live demonstration 3.Extensibility.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
July 2011CMSC 341 CVS/Ant 1 CMSC 341 Java Packages Ant CVS Project Submission.
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
Write-through Cache System Policies discussion and A introduction to the system.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Module 10 Administering and Configuring SharePoint Search.
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
Ant & Jar Ant – Java-based build tool Jar – pkzip archive, that contains metadata (a manifest file) that the JRE understands.
Entity Framework Code First – Beyond the Basics Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
SAN DIEGO SUPERCOMPUTER CENTER Inca Control Infrastructure Shava Smallen Inca Workshop September 4, 2008.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Philip Repsher October 29 th, 2008 Or Maybe November 3 rd, 2008.
Facebook is a social utility that connects you with the people around you. Use Facebook to…  Keep up with friends and family  Share photos and videos.
SPI NIGHTLIES Alex Hodgkins. SPI nightlies  Build and test various software projects each night  Provide a nightlies summary page that displays all.
Institute for the Protection and Security of the Citizen HAZAS – Hazard Assessment ECCAIRS Technical Course Provided by the Joint Research Centre - Ispra.
Clarens Toolkit Building Blocks for a Simple TeraGrid Gateway Tutorial Conrad Steenberg Julian Bunn, Matthew Graham, Joseph Jacob, Craig Miller, Roy Williams.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Google Code Libraries Dima Ionut Daniel. Contents What is Google Code? LDAPBeans Object-ldap-mapping Ldap-ODM Bug4j jOOR Rapa jongo Conclusion Bibliography.
Web Services Essentials. What is a web service? web service: software functionality that can be invoked through the internet using common protocols like.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
BIT 286: Web Applications Lecture 04 : Thursday, January 15, 2015 ASP.Net MVC -
EndNote Ver.X7: A Reference Management Software
Presented By P.SRIVIDYA 085D1A0552 Programming Language.
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
WampServer 2 Installation WAMP is a solution stack of open source programs used together to run dynamic Web sites or servers Most common expansion:  Windows,
Air Plugins Extending and customizing uDeploy (IBM UrbanCode Deploy)
Integrating ArcSight with Enterprise Ticketing Systems
Working in the Forms Developer Environment
Node.js Express Web Applications
Section 13 - Integrating with Third Party Tools
Tomcat Celsina Bignoli
Play Framework: Introduction
Node.js Express Web Services
Servlet API and Lifecycle
Testing REST IPA using POSTMAN
April Webinar: Advanced Configuration of Order Forms in Workflow
ISC440: Web Programming 2 Server-side Scripting PHP 3
Business Process Management Software
PowerShell Best Practices for SQL DBA’s
Cordova & Cordova Plugin Installation and Management
Intro to PHP.
Python and REST Kevin Hibma.
Bijay Kumar Sahoo Office Server & Services MVP (SharePoint)
Lecture 34: Testing II April 24, 2017 Selenium testing script 7/7/2019
Chengyu Sun California State University, Los Angeles
Web Application Development Using PHP
Presentation transcript:

Basic Programming in Ruby Today’s Topics: Introduction last class irb history log Methods Classes (briefly) Using 3 rd Party Libraries rubygems ‘ require ’ method in ruby Using 3 rd Party Libraries web scraping with Hpricot BioRuby Automating Genboree via Ruby & Genboree API and learning a few more libraries and HTTP programming Last time I used the interactive Ruby shell ‘irb’ to do examples. Today, we’ll look at and run examples in Ruby scripts.

Methods & Classes Methods can define at any time and use thereafter methods can have parameters or arguments argument variables are available within the method code arguments can be optional, having a default value more complex methods can take code block arguments they can execute this code block at an appropriate time they can call the code block and supply arguments to it Basic Method Definition: def methodName(arg1, arg2, arg3=true) # … … return resultVariable end Ways of calling that one would be: result1 = methodName(value1, value2, value3) # OR result2 = methodName(otherValA, otherVal2) [ example – useMethod.rb ]

Using 3 rd Party Libraries Libraries contain useful classes with methods so you don’t need to write your own Ruby comes with many useful libraries (“standard library”) But lots of other functionality out there for more specific tasks Rubygems rubygems is a tool that downloads, configures, and installs 3 rd party libraries for you makes library management and access easy install this tool from essential commands (on the command line, not irb): gem help # ha! gem list –-local gem install # e.g. gem install rest-open-uri gem list --remote bio make sure you include require 'rubygems ' at the top of each ruby program or make use of one of the more convenient approaches in the manual “ require ” core Ruby method use “ require ” to tell Ruby you want to use some library in your code Ruby will import the library and make its classes available to you require 'rubygems' require 'bio'

Classes & Methods Classes D efine a class, then call its new() method to make instances/object of that class we did this for Array, Hash, etc, last time  anArray = Array.new() Classes contain things like: variables local & specific to each object created via new() methods (used to ask questions or get the object to do things) properties (a.k.a. attributes) also: class-level variables, class-level methods, constants, etc NOTE: object methods defined in a class automatically have the self variable defined the Ruby compiler makes it available for you automatically self is the object the method was called for (same as “ this ” in Java and C++) it’s not really needed much anyway, since Ruby will look for variable names in the object automatically if it doesn’t find the variable locally in the method Classes can inherit from existing parent classes get the methods and variables of the parent but also your more specific methods [ example - classUse.rb & classInheritanceUse.rb ]

3 rd Party Library Examples Web scraping with Hpricot example: extract info from online biological database’s web pages getCutSite.rb BioRuby collection of biological-related classes and methods DNA/AA sequence info biorubySequence.rb Querying PubMed for papers biorubyPubMed.rb

Automating Genboree via Ruby and the Genboree API Genboree has a REST-style API (like Google, Amazon, Facebook) operates over HTTP, like web browsers do your program composes a proper URL for the data resource you want to retrieve, change, or delete URL will contain the Genboree host where the data lives and a path describing the resource any optional parameters the resource recognizes 3 required parameters for effecting authorization your program them calls one of the 6 standard HTTP methods GET  retrieve something from server PUT  place/update something on server DELETE  remove something from server Read more at: and subsections. [ examples: apiExample1.rb (modify) & apiExample2_putLFF.rb ]