1 winter quarter 2005rolando v. raqueño twas the lecture before holiday break readings present...

39
Winter Quarter 2005 Rolando V. Raqueño 1 1 Twas the Lecture Before Holiday Break Readings Present Makefiles Simple Widget Programs

Upload: theodore-holmes

Post on 31-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Winter Quarter 2005 Rolando V. Raqueño 11

Twas the Lecture Before Holiday Break

Readings

Present

Makefiles

Simple Widget Programs

Winter Quarter 2005 Rolando V. Raqueño 22

Holiday Reading

• The Cuckoo’s Egg (Gift Quiz Material)– QUIZ about the book when we come back

References for doing homework and final project• Gumley Chapters

– 2, 3.1-3.2,4.1-4.4 (programming)– 7.1-7.5 (displaying images)– 9.1-9.3 (GUI programming)

• UNIX Power Tools Chapters– 48-51

Winter Quarter 2005 Rolando V. Raqueño 33

Holiday Assignment

• Read the Cuckoo’s Egg – (Gift Quiz when we return)

• Listen to Linus Torvalds Interview• Post a CoolTool Topic Page

– A tool you found that everyone should use

• Post More info about your Final Project• (Possibly) view last Friday’s Computer

Science Seminar– Need to transcode DVD of it.

Winter Quarter 2005 Rolando V. Raqueño 44

FINAL Project Information

• Two Design Review presentations (10-15 minutes long)

• A Final Document of your Project

• Wiki Page Describing your Project– YourNameIdlGuiProject

• Teaming is Encouraged– LastNamesIdlGuiProject

Winter Quarter 2005 Rolando V. Raqueño 55

Final Project

• Post on the wiki a half page abstract of your intended GUI design, and the problem domain that it addresses.

Winter Quarter 2005 Rolando V. Raqueño 66

netpbm.tgz

netpbm.tgzThis is the package that contains the entire PBMPLUS (also known as netpbm) and is distributed in a format known as

Compressed TAR File or

gzipped TAR file

Winter Quarter 2005 Rolando V. Raqueño 77

present.tgz

• To illustrate how to process these types of files, there is a file called simpler file (present.tgz) which can be accessed via anonymous ftp from

% ftp ftp.cis.rit.edu

Winter Quarter 2005 Rolando V. Raqueño 88

Anonymous ftp session login

% ftp ftp.cis.rit.edu

Name (ftp.cis.rit.edu:rvrpci): anonymous

331 Guest login ok, send your complete e-mail address as password.

Password:

Winter Quarter 2005 Rolando V. Raqueño 99

Most important ftp command

ftp> ?

Winter Quarter 2005 Rolando V. Raqueño 1010

ftp session change directory

ftp> cd people/rolo/simg726250 "/people/rolo/simg726" is new cwd.ftp> ls200 PORT command successful.150 Opening ASCII mode data connection for /bin/ls.

Makefile_example.tgzfortran_stats.tgzpresent.tgz226 Listing completed.54 bytes received in 0.015 seconds (3.50 Kbytes/s)

Winter Quarter 2005 Rolando V. Raqueño 1111

ftp file transfer type

ftp> ascii

200 Type okay.

ftp> binary

200 Type okay.

Winter Quarter 2005 Rolando V. Raqueño 1212

ftp getting a single file

ftp> get present.tgz

200 PORT command successful.

150 Opening ASCII mode data connection for present.tgz (1211 bytes).

226 Transfer completed.

local: present.tgz remote: present.tgz

1219 bytes received in 0.015 seconds (80.45 Kbytes/s)

Winter Quarter 2005 Rolando V. Raqueño 1313

Getting multiple files

ftp> promptInteractive mode off.ftp> hashHash mark printing on (8192 bytes/hash mark).

ftp> mget *.tgz200 PORT command successful.150 Opening ASCII mode data connection for Makefile_example.tgz (31544 bytes).

##

Winter Quarter 2005 Rolando V. Raqueño 1414

Getting out of ftp

ftp> quit

221 Goodbye.

Winter Quarter 2005 Rolando V. Raqueño 1515

Most common ftp mistake

• Sending a binary file under ASCII mode

• Result– Characters not conforming to the ASCII

character set are removed

• ALWAYS– Check the size of the source file and the

transferred file

Winter Quarter 2005 Rolando V. Raqueño 1616

DO NOT USE FTP FOR OTHER THAN anonymous ACCESS

• Why?– ftp considered insecure– passwords are not encrypted

• Alternatives– scp (secure copy)– http://ftp.ssh.com/pub/ssh/SSHSecureShellClient-3.2.9.exe– Package also includes ssh client as an alternative to telnet or rsh

Winter Quarter 2005 Rolando V. Raqueño 1717

Uncompressing and UnTAR

• To uncompress the file% gunzip present.tgz

• To extract the contents of the tar file% tar xvf present.tar

• Challenge - look at the file xmas.c and figure out what it does% cd present% more xmas.c

Winter Quarter 2005 Rolando V. Raqueño 1818

Compiling the Package

• To compile or build the package, a Makefile is typically present which is an automatic mechanism to compile all the files and place them in the proper locations% make

• To run the program% ./xmas

Winter Quarter 2005 Rolando V. Raqueño 1919

What is a Makefile

• A makefile is a description of how to build “things” in UNIX

• Automates the creation of “stuff”

• It is different from a script or batch file– Describes the relationship of components

to the resulting object– Keeps track of intermediate results and

their age

Winter Quarter 2005 Rolando V. Raqueño 2020

Other Makefile examples

• Fortran_stats.tgz

Winter Quarter 2005 Rolando V. Raqueño 2121

Fortran_stats example

• Compile a fortran program that computes the mean of 1,2,3,4,5

• To compile the program% make

• To run the program% stats

Winter Quarter 2005 Rolando V. Raqueño 2222

Fortran_stats

% more Makefilestats : main.o sum.o mean.o g77 -o stats main.o sum.o mean.o main.o : main.f g77 -c main.fsum.o : sum.f g77 -c sum.fmean.o : mean.f g77 -c mean.fclean: rm *.o

Winter Quarter 2005 Rolando V. Raqueño 2323

Fortran_stats% more MakefileFORTRAN = g77stats : main.o sum.o mean.o $(FORTRAN) -o stats main.o sum.o mean.o main.o : main.f $(FORTRAN) -c main.fsum.o : sum.f $(FORTRAN) -c sum.fmean.o : mean.f $(FORTRAN) -c mean.fclean: rm *.o

Winter Quarter 2005 Rolando V. Raqueño 2424

Typical unreadable makefile

% more makefileFORTRAN = g77OBJS = main.o mean.o sum.o.f.o: $(FORTRAN) -c $*.fstats: $(OBJS) $(FORTRAN) -o stats $(OBJS)clean: rm *.o

Winter Quarter 2005 Rolando V. Raqueño 2525

Widget Programming

Winter Quarter 2005 Rolando V. Raqueño 2626

Widget

• What is a widget?– It is a graphical user interface component

• Basic IDL Widget Toolkit– Widget_Base, Widget_Button– Widget_Draw, Widget_DropList– Widget_Label, Widget_List– Widget_Slider, Widget_Text

Winter Quarter 2005 Rolando V. Raqueño 2727

Widget_Base

• This widget type is used to hold other widget types. You can think of this as your blank canvas. It is also known as the “parent window” in other terms.

• To invoke a widget base, you would give the following commands

IDL> base = Widget_Base()

IDL> Widget_Control, base, /realize

Winter Quarter 2005 Rolando V. Raqueño 2828

What the IDL Commands Mean

• base = Widget_Base()– In this function call, base will contain a unique

identifier (ID) to this specific instance of a blank window. The window is still described in memory, but not displayed

• Widget_Control, base, /realize– This tells IDL to display the entity with the ID

value in the variable base

Winter Quarter 2005 Rolando V. Raqueño 2929

Result of the Widget_Base

• You should see a blank window similar to the one below

Winter Quarter 2005 Rolando V. Raqueño 3030

Other Widget Types

• To invoke a Widget_ButtonIDL> button1 = Widget_Button( base )

IDL> Widget_Control, base, /realize

Winter Quarter 2005 Rolando V. Raqueño 3131

To Change the Title of a Button Widget

IDL>Widget_Control,button1,Set_Value=“OK”

Winter Quarter 2005 Rolando V. Raqueño 3232

Destroying a Widget

IDL> Widget_Control,button1,/destroy

Winter Quarter 2005 Rolando V. Raqueño 3333

To Destroy the Base Widget

IDL> Widget_Control,base,/destroy– If there are any widgets attached to the base,

those children widgets will also be destroyed.

Winter Quarter 2005 Rolando V. Raqueño 3434

Other Widget Examples

IDL> base=widget_base(column=1)

IDL> button=widget_button(base)

IDL> label=widget_label(base)

IDL> widget_control,base,/realize

Winter Quarter 2005 Rolando V. Raqueño 3535

Other Widget Examples

IDL> base1=widget_base(column=1)

IDL> list1=widget_list(base1)

IDL> slider1=widget_slider(base1)

IDL> widget_control, base1, /realize

Winter Quarter 2005 Rolando V. Raqueño 3636

Adding to the Previous Example

IDL> base2=widget_base(base1,row=2)

IDL> button1=widget_button(base2, value="First Button")

IDL> button2=widget_button(base2, value="Second Button")

IDL> widget_control,base1,/realize

Winter Quarter 2005 Rolando V. Raqueño 3737

Modifying Previous Example

IDL> widget_control,slider1,set_value=100

IDL> widget_control,base1,/realize

IDL> widget_control,button2,set_value=

"Last Button"

Winter Quarter 2005 Rolando V. Raqueño 3838

Getting Information from a Widget

IDL>widget_control,button1,get_value=button_value

IDL>print,button_value

First Button

Winter Quarter 2005 Rolando V. Raqueño 3939

Have a Safe and Happy Holiday

Remember, friends don’t let friends program drunk