Dynamic Web Programming: python pg and cgi modules Mansi M. Kasliwal Carnegie Institution for Science California Institute of Technology.

Slides:



Advertisements
Similar presentations
PHP: Date() Function The PHP date() function formats a timestamp to a more readable date and time.
Advertisements

MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
WaveMaker Visual AJAX Studio 4.0 Training
Keys, Referential Integrity and PHP One to Many on the Web.
Web Database Programming Connecting Database to Web.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
4/8/99 C. Edward Chow Page 1 Active Server Page It is a server-side scripting environment for creating dynamic content. ASP are files with.asp extension,
4/8/99 C. Edward Chow Page 1 Internet Services Manager Click Start | Programs | Administrative Tools | Internet Services Manager.
Introduction To Form Builder
Using Social Care Online: an overview Version 1.0 April 2015.
The Design Of A Web Document Snapshots Delivery System David Chao College of Business San Francisco State University.
Python Web Applications A KISS Introduction. Web Applications with Python Fetching, parsing, text processing Database client – mySQL, etc., for building.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
MySql In Action Step by step method to create your own database.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
Copyright  Oracle Corporation, All rights reserved. 5 CMIS Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Eurotrace Hands-On The Eurotrace File System. 2 The Eurotrace file system Under MS ACCESS EUROTRACE generates several different files when you create.
Stored Procedures, Triggers, Program Access Dr Lisa Ball 2008.
2 Copyright © 2004, Oracle. All rights reserved. Running a Forms Developer Application.
IE 423 – Design of Decision Support Systems Database development – Relationships and Queries.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
System Initialization 1)User starts application. 2)Client loads settings. 3)Client loads contact address book. 4)Client displays contact list. 5)Client.
Dreamweaver MX. 2 Overview of Templates n Forms enable you to collect data from ______. n A form contains ________ such as text fields, radio buttons,
Chapter 1 Review Chapter 2 Whatcha Gonna Do???
The Digital Archive Database Tool Shih Lin Computing Center Academia Sinica.
XP Chapter 4 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Collecting Data for Well-Designed Forms Chapter 4 “Making.
EPI 218 Queries and On-Screen Forms Michael A. Kohn, MD, MPP 9 August 2012.
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Using Flash with php Very quick introduction to Flash Homework: work on projects.
HTLM Forms CS3505. Form Handling in Browser html User Files out form WEbBROWSErWEbBROWSEr User read response submit Get URL?input html Get file html script.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Creating Web Page Forms COE 201- Computer Proficiency.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
PubMed/How to Search, Display, Download & (module 4.1)
1 Research Papers Database. 2 Form – Add – Delete – Change … information in the database.
Table Structures and Indexing. The concept of indexing If you were asked to search for the name “Adam Wilbert” in a phonebook, you would go directly to.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
2 Copyright © 2004, Oracle. All rights reserved. Running a Forms Developer Application.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
CS242 SQL. What is SQL? SQL:  stands for Structured Query Language  allows you to access a database  is an ANSI standard computer language  can execute.
Running a Forms Developer Application
CS320 Web and Internet Programming SQL and MySQL
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
Structured Query Language (SQL)
Library Reserve System
DB Implementation: MS Access Queries
CS3220 Web and Internet Programming SQL and MySQL
MySQL Database System Installation Overview SQL summary
To insert a hyperlink ( a web page address, URL) using text
Grauer and Barber Series Microsoft Access Chapter One
CS3220 Web and Internet Programming SQL and MySQL
Presentation transcript:

Dynamic Web Programming: python pg and cgi modules Mansi M. Kasliwal Carnegie Institution for Science California Institute of Technology

Database Logical tables to organize large amounts of data Easy-to-manage: add/subtract/modify Structure facilitating super-fast complex queries Python “pg” module connect query, insert, delete, update (Note: psycopg2 module for cursor handling in large databases, copy command etc.) 2

An Example Database Schema createdb tutorial psql –d tutorial CREATE SEQUENCE people_id_seq; CREATE TABLE people ( id bigint NOT NULL default nextval(‘people_id_seq’), firstname text, lastname text ); CREATE TABLE education ( people_id bigint, subject text, degree text, college text, year int ); 3

Example pg commands import pg #Connect to Database db = pg.connect(dbname=‘tutorial’, host=‘localhost’, user=‘mmk’) #Add Entries db.insert(people, [firstname=‘mansi’, lastname=‘kasliwal’]) delete(table, [d,] [key = val,...]) update(table, [d,] [key = val,...]) #Example Query Joining Two Tables result = db.query(“SELECT * from people, education WHERE people.id = education.people_id AND subject=‘astronomy’;”) 4

Dynamic Web Programming Generate nimble webpages on-the-fly that push and pull data to and fro a database Python “cgi” module is easy-to-use URL: GET method e.g. tutorial.cgi?firstname=‘mansi’&lastname=‘kasliwal’ FORM: POST method Radio buttons or check boxes Drop down menu File upload/download Blank Text Area Retrieving cookies e.g. os.environ['REMOTE_USER'] (Note: wsgi is more portable than cgi since it unifies the application programming interface; wsgi = Web Server Gateway Interface) 5

Example Form 6 #!/usr/bin/python # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form =cgi.FieldStorage() # Put up a form First Name: Last Name: # Get data from fields first_name = form.getvalue('firstname') last_name = form.getvalue('lastname') #Insert entry into database db.insert(people, [firstname=‘%s’, lastname=‘%s’] %(first_name, last_name))

Check box / Dropdown Menu Maths Physics 7 Maths Physics

Applications in Time Domain 1.A Treasures Portal 2.Follow-up Marshals a.Extragalactic Transients b.Milky Way Variables c.Solar System d.Target-of-opportunity 8

iPTF Treasures Portal 9 Developers: MMK, Yi Cao

The iPTF Treasure Chest 10 A versatile portal with query derivatives: 1.ROBOTIC treasurer 2.SYSTEMATIC daily monitoring 3.YOUNG supernovae 4.GAP transients in the local universe 5.SLOWLY rising supernovae 6.LARGE amplitude stars 7.Fermi/Icecube target of opportunity fields triggers 8.M31/M33 transients and variables 9.FAST Transients 10.NUCLEAR Transients Developers: MMK, Yi Cao, Iair Arcavi

11 Developers: Robert Quimby, MMK, Iair Arcavi

12

13

Light Curves: Key to Variable Stars 14 Developers: David Levitan

Automatically match with SDSS, WISE, Simbad Links to NED, CRTS, LINEAR, etc. Periods 15

Period search 16

Movement: Key to Asteroids 17 Developer: Adam Waszczak

Target-of-Opportunity Marshal 18 Developer: Leo Singer

Questions? 19