Monday, June 24, 2013

Recursion in Pascal

Recursion is the process of a sub-program both function and procedure that calls itself.

Example:
Program Rekursi_pascal;
uses Crt;
procedure rekursi(A:integer);
begin
if A < 10 then
begin
write(’Pascal’);
A:=A+1;
rekursi(A);
end;
end;

var
x:integer;
begin
clrscr;
x:=3; ———> nilai X dapat kita tentukan sendiri
rekursi(x);
readln;
end.


Example factorial using recursion:
Program Faktorial_pascal;
function Faktorial(a:integer):longint;
begin
if (A=1)then
Faktorial:=1
else
Faktorial:=a*faktorial(a-1);
end;
var
x:integer;
begin
writeln(’Faktorial sequence’);
write(’Berapa Faktorial :’);readln(x);
writeln(x,’faktorial ‘,’=',faktorial(x));
readln;
end. 


Examples for the indefinite recursion pascal is a process that is done without stopping or an endless recursion. 
 Program rekursi_indefinite;
procedure rekursi;
begin
write(’Pascal’);write;
rekursi;
end;
begin
rekursi;
readln;
end.


Tower of Hanoi Code

uses crt;
var n, langkah: integer;
asal, bantuan, tujuan: char;

procedure hanoi (jumlah:integer; asal, tujuan, bantuan: char; var langkah :integer);
begin
if jumlah=1 then
begin
langkah:=langkah+1;
writeln(' pindahkan dari ',asal,' ke ',tujuan);
end
else
begin
hanoi(jumlah-1, asal, bantuan, tujuan, langkah);
hanoi(1, asal, tujuan, bantuan, langkah);
hanoi(jumlah-1, bantuan, tujuan, asal, langkah);
end;
end;

begin
readln(n);
langkah:=0;
hanoi(n,'A','C','B',langkah);
writeln ('Diperlukan ',langkah,' langkah');
readln;
end.

Trick add bandwidth by Mozilla

Friend caw have feel snugly again browsing which silent although user but make browsing remain to slow, download also slow... that because every room have in limiting bit rate and bandwidth... so now that problem could probably be overcome in this way:

1). Open Browser Mozilla Firefox.

2). At Address of Bar write : ABOUT:CONFIG

3). Look for string hereunder : ( ascertaining all string of following. "TRUE")

follow the example of to change it :
network.http.max-connections - 64
network.http.max-connections- per-server - 20
network.http.max-persistent- connections- per-proxy - 10
network.http.max-persistent- connections- per-server - 4
network.http.pipelining - true
network.http.pipelining. maxrequests - 100
network.http.proxy.pipelining - true
network.http.request.max- start-delay = 0
network.http.request.timeout - 300
nglayout.initialpai nt.delay = 0
browser.tabs.showSingleWindow ModePrefs - true

6). Later then REFRESH or Depress F5.

7). At Address of Bar write : ABOUT:BLANK
Click Menu:

To OS Windows XP TOOLS>>OPTIONS>>WEB FEATURES
To OS Linux ( Vector ) EDIT >> PREFERENCES
For different Setting in some OS EDIT >>ADVANCED

9). At Option :
ALLOW WEB SITES TO INSTALL SOFTWARE Say The Word Check Box To activate.

10).Later then Depress O.K. Then REFRESH. ( F5 )

11).Step Into This Link :
a. http://addons.mozilla.org
or :
b. http://addons.mozilla.org

12).Download Software Switch Proxy Tool version 1.3.4

13).After Finishing Don't Depress Knob UPDATE.

14).Click Sign X (close) of Exist In Right Corner For From POP UP Window Which Emerge.

15).Close All Browser Mozilla Firefox,

16).Later then Open Again To Activate Software Switch proxy Tool of Version 1.3.4 in Mentioned Install.

17).Installation Have Successful, Will Emerge additional Tool bar Below/Under Tool bar Navigations & Address Bar.

Now Browser Mozilla of Ready For Used.…….
:: Message ::
---
Software Switch proxy Tool of Version of 1.3.4 This besides to Change Proxy Automatically In Browser Mozilla Firefox, Engine Also Have an effect on to Speed of connection.

---
Way Of This Very Effective if used for Solid browsing of Visitor to Inhale Bandwidth ( Majority of Speed access Internet ) To Computer Which Your is Medium Wear.

---
Change Which Significant Become Of By connection By BROADBAND / VSAT

Way of above I have try and succeed at certain Browsing of but of if at browsing having management of bandwidth nicely I use IDMAN ( Internet Download Manager)

Way list of Google Adsense

I will try to study in around Google Ad Sense, and this is hit the way of enlisting. But before stepping on to especial topic namely how to enlist in Google Ad Sense of there are some matter or more precise I mention how in order to our blog is more conducive to in accepted to become member from Google Ad Sense, because do not the owner seldom blog which wish to follow this program feel to discourage in causing party of Google Ad Sense refuse from self's membership.

What need in considering is the way of which I give this is not an absolute matter if done will 100 gratuity guarantee great friend in accepted in Google Ad Sense, however only a tips upon which consideration of great friend of all. Well, hereunder I give quicker some ways in order to in accepted by Google Ad Sense:

# English Language

Blog which is in registering to Google Ad Sense have especial of English language, because English language represent language which is in support by Ad Sense, what need in knowing is us have in accepted by Ad Sense, we earn its save advertisement code at our blog is the other, is not limited to blog which is registering. Become just to pass selection, better make first blog which have language to English. How if language cannot English and perhaps don't have blog which have language to English? Great friend don't beforehand break expectation, please try first register a blog in Ad Sense of because have a lot of blog which have language to of Indonesian even also can in accepted by Ad Sense.

# Have a lot of posting article

Generally this which is often happened, a blog newly become and only contain one or two just posting article have in registering to Ad Sense. Better fill beforehand blog with a few posting article, minimum have had 4 article fruit then try to register in Ad Sense.

# Design Blog have to be regular

Better arrange beforehand blog to in registering to Ad Sense, although Google Ad Sense do not oblige that which is in registering is a site or blog having the character of professional, but Ad Sense do not wish its advertisement at blog impressing in design of origin become.

# Blog someone has visited

That our blog have there its visitor, minimize have in visiting by 100 visitor people. Others which need in considering is this business Google Ad Sense represent very business base on all visitor blog, just free useless if us have had advertisement of Ad Sense but still be silent of visitor. In order to a blog of a lot of in visiting visitor of course we the promotion have to be cheerful there here and fill from our blog there is matter which is in feeling be of benefit to all visitor blog.

Possible just that first some from me in order to blog of bigger great friend is possibility of in accepted by Google Ad Sense. Have ready for enlisting to Google Ad Sense? Well, please follow stages steps in the following is:

1. To enlist Ad Sense of great friend can click at banner residing in right side for this blog

2. After be at site Google Ad Sense, please click knob drop down which be at upside and select choose language Indonesian in order to more in understanding by us.

3. Click knob Enlist now

4. There are some forms which must in content:

* URL Website [?] –> fill care of URL great friend. Follow the example of: http://dolphoo.blogspot.com/

* language of at website –> click menu dropdown, last select choose especial language from blog great friend, language of English or language Indonesian

* Type Account –> select choose individually.

* State or regional –> select choose Indonesian (corresponding to great friend residence)

* Name of payment Receiver –> fill by the name of complete of great friend. This of vital importance, don't in shortening. Example of: Putri Boy Pratama don't in shortening to become General Putri BP.

* Address –> fill complete care of great friend.

* Town –> fill by the name town of where great friend omit. Example of: Bandung.

* Shares state –> needn't, this special to be American

* Zip code –> fill with zip code.

* Phone –> content with number phone great friend.

* Under policy article, great friend please fill all containing small box of agreement that great friend agree it

* Click knob of Submit Information.

5. Finish.

Step hereinafter is a wait enamel consignment from Google Ad Sense.

Acessoris bloger

Following a number of "ornament" blog can be attached in your blog is function do not only as ornament but also to find favor in eyes clan blogger (read, visitor) and search engine. Again important to remember, these Accessories can only be attached at blog which template can be edited by like blogspot.com, blog drive.com of plus of blog which domain or hosting buys by self, perhaps.

1. Guest Book
Guest blog book referred as also shout box or tag board. Is of equal guest website book, but it’s for more simple. A lot of free site provider guest blog book is which you can look for in Google with keyword shout box or tag board. http://shoutmix.com of is inclusive of provider guest blog book took a fancy to which server enough stabilize.
Its way:
  1. Enlist in above address, follow all its command
  2. After finishing, login by ID and is enlisted PASSWORD
  3. Click menu "Code Generator"
  4. Select Choose Full Frame shout box
  5. Click "Generate The Code"
  6. Copy code of existing HTML, and include to Your template blog in shares Sidebar
  7. Click save setting & republish
  8. Finish.
Function of the book this guest blog such as those which you know to make owner blog interaction (blogger) with visitor more active and indicate that its people us enough accessible.

2. Statistic and Tracker
Functioning to know how much many incoming visitor every day, each week, and the month moon and from just which state. Others, he in forms us of through such that visitor comes: through seeking in Google or via blog or site of other dissimilar installing our link blog. Free statistic or tracker of most famous there is two Site meter and Extreme Tracking.

Congratulation Try and success always…

Trick Exact Pacify Important File From VIRUS

Latterly I am more and more hearing and meeting case of attack of virus which is in its spreading is joined to vanish and or destroy file by extension is certain, what is most attack addressed at Document file (*.doc, *.xls, *.ppt, *.txt and other) especially at file which of extension *.doc. This matter make many people very fear till they diligent of self back up periodic file in the manual, till install software antivirus and also software of other dissimilar protection is which sometime less be effective and very disturbing own self. Hence from that's I write article of this continuation is which hopefully can overcome the problem.

Nucleus Core from this Article in fact very simple that is rename of all extension of important file at one blow in a Drive once is click. Here I use aid of script VBS for its applying.

* info: Generally, first I use this script for rename file of video from VCD which extension *.DAT become *.MPG in order to can be come up (Thumbnail) of Appearance Explorer.

Virus groan some file type in relying on file extension, and because of most virus groan file *.doc, hence in example of hereunder I will apply it at this file, that is fox extension *.doc become *.MSWORD. (you can also may determine result rename by self besides *.MSWORD )
  • Following in this step:
1. Open RUN write notepad.exe so press enter.
2. After application of notepad emerge to type or copy > paste under script :
Dim Drive, Root, fname
Drive = "D" 'drive to be processed'
Set Root = CreateObject("Scripting.FileSystemObject")._
GetDrive(Drive).RootFolder
Set fname = New RegExp
With fname
.Pattern = "\.doc$" 'extension file to rename’
.IgnoreCase = True
.Global = False
.Multiline = False
End With
Call Rename(Root, fname)
Sub Rename(Folder, RegExp)
Dim SubFolder, File
For Each File in Folder.Files
If RegExp.Test(File.Name) Then
File.Name = RegExp.Replace(File.Name, ".MSWord") 'result rename’
End If
Next
For Each SubFolder In Folder.SubFolders
Call Rename(SubFolder, RegExp)
Next
End Sub
  • Its way is:
1. Enter Control Panel > Folder Options > Files Type
2. Look for and click knob "New" last at column "File Extension: "type "msword" (if you conduct modification of at script and alter string "MSWORD" with other dissimilar, accommodate).
3. Knob click "<<>
4. Last click “OK”
5. Finish…
6. (Optional) change picture default icon in order to be not gullible with virus file which often icon look like File Word.
If you wish to alter also important extension file of other you enabled can be attacked by virus of like *.xls, *.ppt, *.txt and others, hence conduct modification of at script and don't forget for the association it again with appearance default program./ process like way of above.
  • Side Effects
a. This Script VBS will only just rename extension file non file name, become for example if you have so called file.doc hence will be altered to become file *.MSWORD. Become don't doubt, its original name nope will change.
b. If file you to change its extension have the character of shared document file or which you make to be propagated to by broaden in local network area and also to other dissimilar computer hence will a few disturbing one who will open it, cause in their computer is the extension of association not yet with appearance program. Become if we like to can open this file better other dissimilar computer of rename return its extension to *.doc or can be opened by: Click - right > Properties > Change…last searched "Microsoft Office Word" (Application Microsoft Word) in column "programs" last click Ok > Apply > Ok - new open.
c. This Applying Script VBS at Drive C:\"maybe" - (maybe very infinitesimal) can bother performance of application figuring in file *.doc of at its process. Hence from that I suggest to remove your important file from drive C:\ to other drive so that drive C:\ needn't in process use this Script VBS.
  • Message to all VMI (Virus Maker Indonesia):
If we like to make virus don't be too harm others, just need, if can develop building.

Learn to make CV (CURICCULUM VITAE)

If you wish to apply for work, You obliged to bring one packet which fill the packet is " history data live or more famous by the name of CV, one sheet snugly the photo, Photo Copy identity of such as KTP, Photo Copy certificate and Other certificate.

First step, make Reference Letter. For Example:

Bandung,
Dear
PT Angin Ribut
Matter : letter of application
Dear,
Herewith I raise letter of intention work for to become staff employees at company Mr. / Mrs.
In the following I submit my personal data:
Full Name : Arief dolpho
Place / Date of Delivering Birth : Your Birthday
Full Address : Jl. Jalan No.1
Phone (Mobile) :  Your Phone Number
Pendidikan terakhir : IT ITENAS Bandung
Yours Faithfully,

Arief dolpho
Enclosure :
  • Curriculum Vitae
  • Photo copy certificate
  • Photo copy KTP and one sheet snugly the photo

Second step, have to make person data. For Example:
CURICCULUM VITAE
Complete Name : Arief DolpHo
Full Address : Your Address
Place / Date of Delivering Birth : Your Birthday
Gender : Male
Marriage Status : Single
National : Indonesia
Religion : Islam
Phone (Mobile) :  Your Phone Number
Your E-Mail : your_email@yahoo.com
URL : Http://dolpho0.blogspot.com
Last Formal Education
1993 – 1995 : Nursery School in Asalam Bandung
1995 – 2001 : Elementary School in Banjarsari Bandung
2001 – 2004 : Junior High School in 20 Bandung
2004 – 2007 : General High School in 16 Bandung
2007 – 2012 : Information Technology ITENAS Bandung
Expert Area
{If Owning ability applied here}
Work Experience
{If Owning experience work applied here}

Organizational Experience

{If Owning applied organizational experience here}


Third step enclose its enclosure
Enclosure :
  • Curriculum Vitae
  • Photo copy certificate
  • Photo copy KTP and one sheet snugly the photo
  • Other certificate

Congratulation Try and success always…

Learning JavaSricpt Language

A. Introduction

When computers have become widespread in schools and homes and their uses in language teaching and learning have expanded dramatically from simple games to global networking, language teachers must now begin to think about the implication of computers for language teaching and learning.

The Internet, and its more recent offspring WWW (World Wide Web), is constantly growing in popularity and availability for all people. This allows commercial and educational organizations shift their materials delivery over the Internet. Many English teachers put their materials online. They create homepages just for the purpose of their classes, or they may design homepages so that every people can learn from them or take the pages for their own purposes.

Once we have access and surfing the Internet, we will find unlimited sources/links. One page is linked to one and the others so that it forms chain of resources. The resources range from individual home pages to institutional home pages like a university Home Page. In this article I try to sort out the ESL Internet resources and classify them into three broad categories. These categories are based on the computer’s roles framework. Tylor’s taxonomies of computer’s role are used here.
This writing is divided into two main parts. The first part (Background) will discuss three main issues. Firstly, the conflict of whether to use or not the computer in language learning is briefly reviewed. This issue should be highlighted since many educators still feel doubtful to bring this technology into classroom. They say that computers cause more frustrating than good. The discussion will cope with the conflict.

The next issue is the computer roles in education. This focuses on Levy’s discussion of tutor-tool-tutee framework. This framework is then chosen to be the feature for classification of the Internet resources made in this paper. Finally, at the end of the first part, I will discuss the ESL/EFL activities on the Internet in brief.
In the second part of this writing, I will take some home pages as examples and classify them according to the tutor-tool-tutee framework. The annotation will be attached to each homepage as brief descriptions.

B. Background


1. The conflict

New technology is often perceived as a promise. Computers, for example, can be tremendously useful for English language learning and teaching. They can process user input quickly, and integrate texts, pictures, sounds, and videos into a package of lessons. They can be programmed to diversify instructions so that it brings in students to learn more. In other words, there is a motivational value of using computers in language learning (Warschauer, 1996a). Therefore, many people argue that computers should be used for language learning. They believe that there are many potential benefits of using computers. However, the issue is not whether they are beneficial or not but rather how they should be used in language learning. Regardless of that whether computers have advantages and disadvantages in educational world in broad sense and in language learning and teaching in particular, for whatever reasons they are already being used and will continue to be used.

Computers are now seen as a hero in educational difficulties like inadequate funding, insufficient teaching stuffs, uninteresting materials, and so on. Some think that computer will eventually replace teachers (Hoffman, 1995/1996). However, it is unlikely that computers will ever meet the most excessive expectations. For example, Frizler (1995) states that it is an imaginary that computers will ever replace teachers. Snyder (1994) also believes that computers can not and should not replace teachers, but should be used by teachers to enhance their instructions. Patrikis (1997), even though slightly incompatibly to previous arguments, remarks that ‘computers are hardly ever to replace teachers, but they are equally unlikely to make poor teachers gifted teachers.’

For whatever reasons stated above, there are some that refute those arguments. Computers are said to be actually worse that useless. For instance, they may cause to reduce creativity of thought, and take precious funding away from other more worthy educational programs (Oppenheimers, 1997). Similarly, Patrikis (1997) argues that technology advances more rapidly than language methodology and pedagogy. As a result, the language learning pedagogy used in the technology is not working harmoniously or is outdated. Furthermore, Murison-Bowie (1993) argues that computers are not being utilized by teachers to their potential. Teachers do not seem to be taking advantages of technology’s possible benefits. He claims that several parties were responsible for this problem—teachers for not being easily-adapted, material developers for not understanding new technologies could be used to meet the profession’s needs, hardware developers for creating restrictive systems which dictate the teaching methods.

Computer-Assisted Language Learning (CALL) has not always been designed and used with the best or most current pedagogical foundation as Patrikis said before. Nancy Hunt (1993) discusses the problem of educators having a narrow view of the use of computer technology, mainly for independent drills and word processing. When in fact newer technologies to be used to help the students actively participate in language learning. Conrad (1996) noted that CALL software in 1980’s seemed to be outdated pedagogical approaches. Not until recently has CALL begun to conform the newer pedagogical approaches.

Finally, a common problem is for the excitement surrounding a new technology to cause teachers to forget to use good pedagogy. For instance, the attractiveness of the Internet or Web causes many teachers to fall into trap of thinking that just having their students online doing language exercises (Frizler, 1995). Therefore, there is a need for considering carefully the use of computer technology. It should be well-received and useful rather than a source of public disappointment. The technology should be used to the maximum level of its capability to enhance language learning, and pedagogical research and practices should lead to what is done with the technology, not the other way round.

In short, I should say that it is outdated to argue whether or not to use computers in education (language learning in particular). Computers are already being used anywhere. They are parts of our daily life. The issue now is not that conflict. However, 'the fundamental issue in the field of CALL is the “fit” between the computer’s capabilities and the demand of language pedagogy' (Wyatt, 1988). It is our duty as language teachers or CALLers to find ways how to maximize the use of computers in our ‘business’, to find the most appropriate pedagogical foundation for their uses.

The end of this conflict (whether or not to use computer technology in language learning) should bring us to another issue of CALL. This issue is about the roles of computer in language learning and teaching.

2. Tutor-Tool-Tutee Framework

I understand why there are still some educators who doubt to use computers in their classrooms. It is because of the essence of computers as machines. Computers are not human beings. They can not think and can neither feel. They just respond as they are programmed. In contrast, a good human teacher has two capacities (Higgins: 1984) which a computer or any machine does not have. One is feeling. A good teacher loves her students. She treats her students humanely. The second capacity is sensitivity. A good teacher can read her students’ feeling. She might know what is wrong with the students. If a mistake occurs, she will know whether it is because of deliberateness, carelessness, or genuine misunderstanding of a concept. On the other hand, computers hardly ever have those capacities.

From this illustration, a question arises: are computers useless in the classroom? The answer is of course ‘no.’ The advantage of using computers varies to some extend depending on how the computers are programmed. This will lead us to the discussion of the roles of computer in language learning and teaching, what computers can and cannot do.

Levy (1997) discusses this issue in great detail but I should start from Higgins’ taxonomies of computer roles. Higgins (1985) discusses two roles of computer, magister and pedagogue (this issue is also discussed in Levy, 1997). In magister role, computers are superior to the human (teachers and students) since they take the control—presenting, questioning, drilling, and evaluating. The other role is pedagogue. Higgins illustrates the pedagogue role as a slave because the computers are passive. They wait for the instructions from the users. They can be ‘a task setter, an opponent in a game, an invironment, a conversational partners, a stooge, or a tool’ (Higgins in Levy, 1997). Higgins (1984) says that computers are bad at magister and good at pedagogue.

Unlike Higgins, Wyatt’s taxonomies of computer roles are more than just two. Wyatt (1984) introduces one more which is called collaborative role beside instructor and facilitator which are relevant to Higgins’ magister and pedagogue respectively. In collaborative role, students and computers cooperate in a certain task. In this case, the student initiate and control the activities that may happen in the computer (Wyatt, 1984). Collaborative software casts students in a much more active role and depemds on them to taqke responsibility for their own learning.

These frameworks (Higgins’ and Wyatt’s) are in line with Tylor’s taxonomies, tutor, tool, and tutee (Levy, 1997). Levy summerises the tutor, tool, and tutee roles of computers as follows.

As a tutor a computer evaluates the learners and then provide next activities accordingly. A computer as a tutor implies that a computer can replace the presence of the teachers and that the activities can happen in self-access mode. Levy says that the nature of ‘computer tutor is the notion of the teacher in the machine rather than the teacher working with the students alongside the machine’. In other words, the computer serves as a vehicle for delivering instructions to the students. Computers as tutor are useful in some cases. Th fact says that CALL drills are still used today (Warschauer, 1996b). According to Warschauer, the rationale behind the computers as tutor is as follows:
  1. Repeated exposure to the same material is beneficial or even essential to learning
  2. A computer is ideal for carrying out repeated drills, since the machine does not get bored with presenting the same material and since it can provide immediate non-judgmental feedback
  3. A computer can present such material on an individualized basis, allowing students to proceed at their own pace and freeing up class time for other activities (Warschauer, 1996b)
Unlike the tutor role, the tool role of computers is to improve the efficiency of work of teachers and students (Levy, 1997). Warschauer (1996b) called this role as ‘computer as workhorse’. In this role, the computers do not necessarily provide learning materials at all, but rather empower the student to understand the lessons (Warschauer, 1996b). Computers as tool include word processing, spelling and grammar checking, desktop publishing program, and concordances.

The role of computers as tutee allows students or teachers to interfere the program. The students do not only simply absorb the materials from the computer (tutor) or respond the computers (tool) but also they should have some kind of interaction between students and computers where the students take more control. In this role computers provide manipulable space or field for creating models or conceptual structures (Levy, 1997). In other words, computers are used as tool to discover the information the computers possess where the students are responsible for initiating and directing the activities that occur in the learning environment.

Two things are clear here. In computer tool framework, computers are used as tool to reinforce the learning such as be a partner in conversation, an opponent in a game, or a challenger in a puzzle. Here student cannot interfere the program at all. On the other hand, in computer tutee framework, computers are used as tool to explore learning environment. For that reason, students take more control or direct the computers to achieve the goal.

3. Language learning on the Internet.

Let us move on to discuss the greater sophistication of computer use in language learning; it is the Internet.
Uschi Felix defines the Internet as “the world’s largest computer networking linking millions of individual computers at different sites raging from commercial business to educational institutions … connected to each other by land cables and other linkages.” One of the outstanding features of the Internet, particularly its more recent offspring World Wide Web (WWW), is that it is multi media. We can put texts, graphic images, audio, video in a single page of HTML (Plass and Chun, 1996). HTML stands for hypertext mark-up language; we use this language to build up a homepage. More technical explanation of the Internet in detail can be read in Uschi Felix’ book ‘Virtual language learning’ part 3, or at http://www.tcom.ohiou.edu/OU_Language/help/index.html the online Internet course by Ohio University.

Once we have begun to collect sites, create our own home pages, we are ready for the next step, putting course materials on-line and making them interactive. There are many different kinds of interactivity possible on the Web today, but what I have in mind are pages which allow (or require) user input (typing, clicking) with appropriate responses to that input or pages which enable users to work collaboratively.

I think we all recognize that our discipline requires a more active kind of learning than most. We cannot learn to use a language by listening to lectures or by just studying the theory (or the grammar). As in learning to play the piano, practice is essential. Therefore, it stands to reason if we are going to consider the Web as teacher's aid, we need to empower that aid to interact with the students, not just to lecture them (computer as tutor). To the extent that it is possible, we want students to work with authentic language materials, and to verify their comprehension through some kind of testing and feedback. We want to have students use the language as much as possible, including outside of class, through writing and speaking. We want students to interact with one another, to use the language for real communication (not just in staged classroom scenarios), to learn from one another. In short, we expect that the learning take place in such environment somehow. All this is doable on the Web, to one degree or another.

There are several styles of user/system interaction possible in standard Web configurations. One of the first uses of the Internet and other digital technologies has been computer-mediated communications. These can be divided into two broad categories: Synchronous and Asynchronous. With "asynchronous applications", messages are either E-Mailed or posted on a system where, upon login, users are notified of the new postings they have not yet accessed. Example systems have traditionally been computer conferencing and computer bulletin boards. In Synchronous Applications users are online at the same time, exchanging messages and other information in real time as they communicate. Examples of this category are Internet Relay Chat (IRC) and Multiple User Domain (MUD) (Sanchez, 1996). This class of interaction system is used for social role playing and is being supplemented as well by the newer MOO for "MUD, Object-Oriented", MUSH "Multi-user Shared Hallucination". Access Steve Thorne's Web page on these technologies for more information. Also see John December's resource list on computer-mediated communication for additional information on these topics in their more generic, non-language learning specific settings. Visit the Web entrance to see how a site functions that is not based on static Web pages.

The final category of interactions is one that is garnering the most attention today with respect to developments surrounding the Web. Going beyond HTML markup commands in a static Web page, this approach does more than increase interactivity on the server side through the use of CGI scripts that tailor what users see. This approach also avoids some of the negative elements of pre-placing assets on the user's local system for quicker access than is possible on the Net. Fitting into this category are developments such as the Java Programming (Reeser, 1997).

Let us keep in mind, however, that we are talking about an electronic means to enhance classroom instruction, to provide students with opportunities to use the language outside of class. Computers and the Web can never provide as effective or efficient a means of learning a language as one-on-one human interaction. With all the type of technological changes, teachers should not fear for their profession or for their job--computers can never replace human beings as has been discussed before.

However, technology is causing and accelerating major social and educational change. Sooner or later, all teachers will be expected to take advantage of some aspects of technology in their teaching. If they do not follow the move, they will be outdated or even will be left behind by their students. Nonetheless, once teachers begin creating dynamic Web pages, they will find they are working in a richly enabling environment, one which allows them not just to follow in the path others have taken, but to invent new paradigms. Fundamentally, we want to use technology to supplement what we do in the classroom and to help in doing what we cannot do very well now (share multimedia, collaborate long distance, make authentic materials comprehensible, etc). But we also want to use the technology to help us think "out of the box", to experiment with approaches we had never thought of before.

On the most basic level, I am talking about beginning with what are essentially Web pages. The Web offers the possibility of making our materials available electronically and putting them into an interactive environment. There are several advantages to doing this on the Web:
  1. Materials can be updated easily.
  2. Students have 24-hour, remote, independent access
  3. The pages can support customized help, review or extra-credit projects to accommodate students at different levels of preparation and ability, including students with special needs.
Let us back to the main purpose of this writing i.e. trying to classify web-based materials according to tutor-tool-tutee framework.

According to Harris as cited in Hackbarth (1997) there are three general type of online materials. The first type is interpersonal exchange. Interpersonal include exercises such as electronic mentoring, email exchanges. I consider this type as computer tool activities because there is two-way communication between a computer and student and communication among students through computers (the Internet). The second type is information collection. I consider this as computer tutor framework because a computer is used to deliver instructional materials. The last category made by Harris is problem-solving project. I categorize this type as computer tutee framework. Although Harris explanation about problem-solving project is not directly related to computer tutee framework, but it implies that students use a computer and take more control. Here students as users put their data and there is collaboration between users and the computers, somehow.

In conclusion, the Internet promotes philosophies of shared resources and knowledge plus active involvement in learning process. Indeed, this rich resource lends itself naturally to being an effective teaching and learning tool for student-centered, communicative and collaborative classroom.

C. Annotated Samples Of Web Sites.


The following sites are examples that represent to the classification that I discussed above. the annotations below the sites are to describe briefly what the examples are about. It is difficult to find a single web site that represents exactly to the frameworks outlined in this writing. One web may represent two or even three frameworks al together (tutor, tool, and tutee). Therefore, the examples listed below are classified according to their dominance. If a tutor-role framework is dominant in a certain site, so then it is classified into the example of tutor-role of computer, and so forth

The number of examples provided here does not show the ratio of the number of web sites available online at hte present time.

1. The tutor role of computer

a. English as Second language URL http://www.lang.uiuc.edu/r-li5/esl/index.htm


English as a Second Language is a starting point for ESL learners who want to learn English through the World Wide Web. This home page links to other ESL sites and other interesting places. The variety of materials will allow students to choose something appropriate for them. Basically this site contains information and links to other ESL sites; however, there are some exercises that allow students to interact with the computers like puzzles. This site also contains large audio files. Copyright © 1994, 1996, 1998 Rong-Chang Li

b. ESLoop URL http://www.tesol.net/esloop/esloop.html

ESLoop is a collection of sites relevant to English Language Teaching and Learning on the World-Wide Web. The ESLoop is run by a cgi-driven system, kindly donated by Sage Weil of the Webring. ESLoop was begun in 1996 as a way to offer teachers and students of English a way to browse the internet for resources specific to English language teaching and learning
ESLoop sites are all relevant to English language teaching and learning in some manner, from student projects and activities to scholarly papers to English for Science and Technology and job opportunities

c. Online English URL http://www.geocities.com/Athens/Olympus/9260/online.html

Online English is an English course organised by Paolo Rossetti from YMCA International College, Vancouver Canada. It is mainly conducted via email between the students and the teacher as the webmaster. The students will receive lessons via email regularly once a week. There will be 52 lessons a year. The lessons will have exercises on useful vocabulary, grammar, reading and listening comprehension and students can access a Conferencing Center for discussions with other members. All materials can be accessed from the Internet. Every lesson will be different and be based on real English used on the Internet.

d. Native American Lore Index Page URL http://www.ilhawaii.net/~stony/loreindx.html

This site is mainly to provide Reading exercises for ESL students. It consists of several stories of Native American Indian Lore from several Tribes across Turtle Island. The students may send their own stories to the web site owner and put them online. There are over 100 stories available here. While we read the stories, we can listen to background music. Copy right 1996.

e. Advanced Composition for Non-Native Speakers of English URL http://www.homestead.com/esl_efl/index.html

This website is for ESL/EFL students who want to learn to write well in English for academic purposes. There are a lot of documents within these pages; however, their organization is simple. First, there are a series of articles that explain how to write effective essays. Second, there are links to stories by professionals. Finally, there are many students' essays, interesting from a multicultural perspective.

For ESL/EFL teachers, this website contains "Advanced Composition" course content. This site also contains a rationale for the use of portfolio development within composition classes.

2. The tool role of computer


a. Poetry URL http://prominence.com/java/poetry/

The Magnetic Poetry Kit by Dave Kapell can be useful for anyone who is interested in writing poems. Students/teachers can simply rearrange some of the 300 words shown on the screen. There are suffixes, prefixes and an extensive word list. They can play online by clicking and dragging or they can print out the list of words to compose their own poem off-line. Copyright © 1998 Prominence Dot Com, Inc

b. EXCHANGE URL http://deil.lang.uiuc.edu/exchange/

EXCHANGE stands for Electronic, Xross Cultural, Hypertextual Academy of Non-native Gatherings in English. The goals of EXCHANGE are to provide an opportunity for non-native English speakers to express themselves through the use of English, to provide resources to enhance English learning, and to create a unique source of knowledge and insight about different cultures. To accomplish these goals, EXCHANGE publishes writings of non-native English speakers from all over the world, and provides English self-study materials. Two of activities of EXCHANGE are Creative writing by individual and collaborative writers. And key-pals to find friends all over the world, to share experiences while learning English. Last updated Friday, April 30, 1999

c. Interactive JavaScript Quiz URL http://www.aitech.ac.jp/~iteslj/quizzes/js/

Interactive JavaScript Quiz is a collection of Quizzes maintained by Charles I. Kelly, Aichi Institute of Technology, Toyota, Japan. These Quizzes are written by ESL teachers around the world in the form of plain text & then converted into JavaSricpt by Charles Kelly.

This site consists of 100 quizzes, and each quiz contains 20 to 100 questions. This site is mainly used to practice grammar, vocabulary and mechanic writing. The grammar quiz covers regular/irregular verbs, preposition, verb forms, question forms, sentence combining, modifiers, adverb often confused, and the like. Similarly, the Vocabulary quiz covers, antonym/synonym, homonym, word category, idiom with parts of body, phrasal verbs, etc; while the quiz for mechanic writing covers like punctuation & capitalization, and so on. There are many forms of Quizzes. They are multiple choices and matching, completion, spelling, hangman, shock wave, word cross puzzle, picture puzzle, etc. this site also links to other ESL quiz links. Last Quiz Added: May 17, 1999

d. Randall ESL Cyber Listening Lab. URL http://www.esl-lab.com/index.htm

This site is designed for both ESL/EFL students and teachers around the world. Registered members can chat in several different rooms, create their own unique profiles for others to look at, find pen friends via the WebBoard, and more. Teachers can use the Chat Center as part of classroom activities or as a means of communicating with other educators. In this site you can also find audio file library which stores various kinds of sounds. Copyright © 1998, 1999

e. CLTA Shocked Grammar URL http://www.clta.on.ca/hillsofmexico/shocked/homshocked01.htm

CLTA Shocked Grammar is one of CLTA services (CLTA stands for Centre for Language Training and Assessment). CLTA Shocked Grammar is a list of shockwave grammar games. There are 31 games here. They are suitable for beginner students. Another similar games can found at http://www.clta.on.ca/hillsofmexico/flash/homflash01.htm

3. The tutee role of computer

I hardly ever find web sites that represent what I mean by computer tutee role framework where the student can take control the web site or interface the program. So far, I found a web site that little represents this category. It is concordancer Space Less URL http://www.spaceless.com/concord/. In this site, the users can put their materials as data source for concordance program. In addition, the users can refer any other URL addresses as data source instead of what concordancer Space Less has.

D. Concluson

There are abundant web sites available for ESL/EFL teachers or students today. They are designed by teachers, students, programmers, researchers, and other experts with different rationale and pedagogy. What I am trying to do is to calcify them according to the programming features, what computer can and cannot do. From my small-scale observation, I found a huge number of web sites which function as tutor and tool in language learning. In contrast, the tutee role of web site is very scare. It might be due to that the tutee role of computer programming is difficult to put online. Otherwise, the observation I made should be expanded.

Classifying web sites according to the tutor-tool-tutee framework of computer role is useful for ESL/EFL teachers to help them decide easily and quickly the web sites that best fit their philosophy of teaching among thousands of web sites available on the web.

The future work can be directed to build up an ESL online resource database which is based on the tutor-tool-tutee framework of the computer role.

History, Congeniality and Follow the example of Javascript

Javascript introduced first time by Netscape in the year 1995. Initially this Language named " Live script" functioning as simple Language for browser Netscape Navigator 2. During the period this Language a lot of criticism since less be peaceful, its development is impressed in a hurry and no mistake message which presenting each time we make mistake at the (time) of compiling program. Then in line with its impetuous medium cooperation between Netscape and Sun during the period, hence Netscape give name "Javascript" to the Language at date of 4 December 1995. At the (time) of which jousting Microsoft by you try for this technological adapting is which they conceive of “Jscript" in browser internet explorer 3.
Javascript is formed Language of corps script which at its function walk at one particular document HTML, as long as Language of this internet Language is first Language script for web. This Language programming to give additional ability to of Language HTML with to allow execute commands beside user, what its meaning beside browser of non beside web.
Javascript base on browser (navigator) calling containing page yard web of Script from Javascript and of course insert in document HTML. Neither Javascript nor need special translator to run. Dissimilar the things of with Language "Java" (by the name of JavaScript always in differentiating) needing special translator to translate it beside User/client.

To be its clearer please download here...

Presenting ' Hello, World!' at screen

Steps make simple template program:
  1. Run software Microsoft Visual C++ 6.0 from Microsoft Visual Studio 6.0 (if need have recourse assistant)
  2. Select File menu -> New
  3. At dialogued by box select tab Projects, hereinafter:
    • Click Win 32 Console Application
    • Write name project, take example FirstProgram at stuffing Project_Name:
    • Determine directory of this place project be at Location: (possibility of filled with your directory home)
    • ClickOK
  4. Will emerge dialogue of box Win 32 Console Application:
    • Select radiobutton A “Hello, World!” application
    • Click Finish
    • Click OK
  5. At small window (generally on the left):
    • Click tab File View
    • Click sign + at FirstProgram files
    • Click sign + at Sourcefiles
    • DoubleClick at FirstProgram.cpp
  6. Select menu Build à Build Firstprogram.Exe or depress F7 at keyboard
  7. Select icon of exclamation mark (!), will emerge window console…

Reading the two integer and present its quantifying result

Guide:
  1. Use steps of making template program as in for step to five , but using Project_Name which differing, for example SecondProgram

  2. Change block program function play with following:
    int integer1; /* first number to be input by user */
    int integer2; /* second number to be input by user */
    int sum; /* variable in which sum will be stored */

    printf( "Enter first integer\n" ); /* prompt */
    scanf( "%d", &integer1 ); /* read an integer */

    printf( "Enter second integer\n" ); /* prompt */
    scanf( "%d", &integer2 ); /* read an integer */

    sum = integer1 + integer2; /* assign total to sum */

    printf( "Sum is %d\n", sum ); /* print sum */

    return 0; /* indicate that program ended successfully */

  3. Do step 6 and 7 template of such as program I.

Trying operator of equation and relationship operator


if ( num1 == num2 ) {
printf( "%d is equal to %d\n", num1, num2 );
} /* end if */
if ( num1 != num2 ) {
printf( "%d is not equal to %d\n", num1, num2 );
} /* end if */
if ( num1 < num2 ) {
printf( "%d is less than %d\n", num1, num2 );
} /* end if */
if ( num1 > num2 ) {
printf( "%d is greater than %d\n", num1, num2 );
} /* end if */
if ( num1 <= num2 ) {
printf( "%d is less than or equal to %d\n", num1, num2 );
} /* end if */
if ( num1 >= num2 ) {
printf( "%d is greater than or equal to %d\n", num1, num2 );
} /* end if */
return 0; /* indicate that program ended successfully */

How to configure Java Server Page runtime environment

NT installed JSP

Windows NT 4.0, Windows 2000 professional, windows 2000 server
Jdk1_2_2-001-win.exe
Tomcat.zip (3.0)

First, download the software JDK
Http://java.sun.com/products/jdk/1.2/
Tomcat
Http://jakarta.apache.org/builds/tomcat/release/v3.0/tomcat.zip

Second, the software is installed (a) JDK
1, double-click jdk1_2_2-001-win.exe document installation, the default configuration installed JDK the default installation directory is C: jdk1.2.
2, JRE default installation directory is C: Program FilesJavaSoftJRE1.2;
3, restart the computer;
4, the following update environmental variables: the C: directory jdk1.2.2 in additional to the PATH; the C: jdk1.2.2libools.jar; C: jdk1.2.2libdt.jar joined in the CLASSPATH.
Update: Control Panel -> -> environment -> System Variables;
(B) Tomcat
1, such as using WinZIP decompress tomcat.zip software to decompress to a directory, I decompress it to the C:, it will automatically create tomcat subdirectories, so that C was more of a directory on the C: / tomcat, I use the logo TOMCAT $ 3, modify Tomcat running of the port, to Tomcat to have a separate HTTP server, it must be used not to use a port, I have here the 8081 has not yet been occupied, I used $ TOMCAT_PORT logo, allocated to the Tomcat: 1) Open $ TOMCAT / server.xml; 2) Revise ContextManager: 4, double click on the directory $ TOMCAT startup.bat to start Tomcat 5 in the browser enter http://localhost: $ TOMCAT_PORT /, Tomcat Version 3.0 can see on this page that Tomcat installation is successful;

Hello, World!

Then use the same javac HelloWorld.java to compile this document, if there is no import javax.servlet .*
So that should be C: \ Tomcat \ common \ lib inside servlet.jar copy files to the C: \ JDK \ jre \ lib \ ext, again compiled, there will be no problem!
Tomcat then the directory C: \ Tomcat \ webapps \ ROOT inside the file structure as follows:
ROOT \ index.html
ROOT \ welcom.jsp
ROOT \ WEB-INF \ lib \ MyServlet.jar (If your servlet's. Fight a class. Jar file, on the lib below)
ROOT \ WEB-INF \ classes \ HelloWorld.class (HelloWorld.class the above documents generated on the inside)

Then enter http://localhost:8080/servlet/HelloWorld browser, the popular will and therefore Server error: Error 404 - Not Found
How all?
Servlet must use the C: \ Tomcat \ webapps \ ROOT \ WEB-INF directory of the following web.xml file registration with the EP open web.xml file,
On the inside to join

HelloWorld
HelloWorld


HelloWorld
/ Servlet / helloworld

This structure

HelloWorld
HelloWorld

That the designation includes servlet class.
And the following structure

HelloWorld
/ Servlet / HelloWorld

HelloServlet that should be designated where a URL mapping mode.
After revising the web.xml finished, restart Server, and then enter http://localhost:8080/servlet/HelloWorld, then lined a Hello, World! Waiting for you? Congratulate you get the:)
Amat, a tired hands, wrote on it here, it is hoped that role for beginners!

. NET Framework's Common Language Runtime

. NET Framework's Common Language Runtime Runtime

CLR?

Mentioned in the previous operation. NET Framework in the code called managed code, contrary called unmanaged code. Compared to unmanaged code, managed code has a lot of advantages, for example, can be used to prepare a variety of programming languages, increase security, version control and procedures easy release, and so on. These are provided by the CLR. But there are also some negative points, the code is easy to think of the speed problem.

To provide for the function of managed code, the code must know CLR data types, classes and she connected with the definition of assembly. This information is called metadata, and metadata contained in the code of a certain part (compiled). CLR use of the metadata loading code segment, memory management, and methods of implementation, such as call operation.

. NET out before, in different programming languages shared between the original code, it is impossible. Every programming language because the definition of different data types, and different syntax. Microsoft masters thought of the data types a good way to reunification. The technology called CTS (common type system). Development projects are now on the relatively simple (in different languages), for example, a project team will use VB, there are and will be using C + +. Previously possible way is to call between the two functions written or COM DLL. But now no such trouble, and you can direct the use of other languages of the code. Specifically, using VB.NET can inherit C + +. NET writing category, in turn, is possible.

We install the software often encountered when such tips - components in the system than to install the new components, you should be retained or replaced? It is so disgusting? ! Now you start with. NET bar, she would not because of this "small" problem and disturb you. Because every code contains the metadata associated with her, and CLR will be the basis of this information to manage different versions of the code. And because the code information not registered to the registry, you can use the X-COPY installed code (as simple as pasting a copy).

Using VB is doing a good job? Still do a good job with C + +? The problem is that we do these projects often time to consider the issue. But. NET programming language with what has become a less important (but still have some differences in specific projects), as provided CLR CTS (and base class library), and above all running on the CLR. In. NET VB, C + + and other languages are quite a lot of increase, and a new language C #. C # application of the standard and has been passed, we can imagine the POWE her. We all know that borland also issued a related development tools C # builder.

Be a Summary

N. NET code contains its own relevant information called metadata.

N CLR provide CTS (CLS also credits), in different programming languages can be shared between the original code.

N using metadata management code information (instead of using the registry), the code is easy to install.

N use a unified data type and class libraries, it becomes the choice of programming language is not important, and easy to team development.

CLR code in the operation process

N compiler options

First choice CLR compiler, as CLR can run in different languages developed code.

N the code compiled into MSIL

Choice of using CLR compiler generated MSIL (Microsoft intermediate language) and metadata to their load to PE (portable executable file).

MSIL: Interpretation language, the code contains information to enable easy JIT compiler into machine language. And unrelated to the operating system and programming language.

PE: executable file format, windows is a DLL or EXE.

N with JIT compiler to MSIL compiled into machine language

There are two ways a compiler is the only current implementation of the code segment, and the other is a one-time code to the compiler. JIT will test the safety of the code.

N code execution

Calling will be the first time the code into machine code compiler, again when it is no longer called re-compiled.

Related tools

- MSIL generator - MSIL Assembler (ilasm.exe)

- MSIL anti-Compiler - MSIL Assembler (ildasm.exe)

Use Act

Http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpconmsilassemblerilasmexe.asp

Java runtime maximize form and closed methods example

In fact, this was originally the basis of a java-related topics, but since it was raised, we might as well say a few words, the way also can be used as a reference for beginners.

/ / 1. Maximize form startup
/ / Frame1.java

Import java.awt .*;
Import java.awt.event .*;
Import javax.swing.UIManager;

Public class Frame1 extends WindowAdapter (
Public Frame1 () (
Frame f = new Frame ();
F.addWindowListener (this); / / f Frame1 set to deal with the incident
Dimension screenSize = Toolkit.getDefaultToolkit (). GetScreenSize () / / by the size of the screen
F.setLocation (0, 0);
F.setSize (screenSize.width, screenSize.height) / / set form the size of the size of the screen
F.setVisible (true);
)

Public static void main (String [] args) (
New Frame1 ();
)

Public void windowClosing (WindowEvent e) (
System.exit (0);
)
)

/ / 2. Closed form in the six methods
/ / 2.1. Use the enableEvents JFrame and processWindowEvent
/ / Frame1.java

Import java.awt .*;
Import java.awt.event .*;
Import javax.swing .*;

Public class Frame1 extends JFrame (
Public Frame1 () (
EnableEvents (AWTEvent.WINDOW_EVENT_MASK);
This.setSize (new Dimension (400, 300));
This.setTitle ( "Frame1");
)

Protected void processWindowEvent (WindowEvent e) (
Super.processWindowEvent (e);
If (e.getID () == WindowEvent.WINDOW_CLOSING) (
System.exit (0);
)
)
)

/ / 2.2. Interface directly to WindowListener
/ / Frame1.java

Import java.awt .*;
Import java.awt.event .*;

Public class Frame1 extends Frame implements WindowListener (
Public Frame1 () (
This.setSize (new Dimension (400, 300));
This.setTitle ( "Frame1");
This.addWindowListener (this);
)

Public void windowClosing (WindowEvent windowEvent) (
System.exit (0);
)
Public void windowOpened (WindowEvent windowEvent) ()
Public void windowClosed (WindowEvent windowEvent) ()
Public void windowIconified (WindowEvent windowEvent) ()
Public void windowDeiconified (WindowEvent windowEvent) ()
Public void windowActivated (WindowEvent windowEvent) ()
Public void windowDeactivated (WindowEvent windowEvent) ()
)

/ / 2.3. Directly inherited form adapter WindowAdapter
/ / Frame1.java

Import java.awt .*;
Import java.awt.event .*;

Public class Frame1 extends WindowAdapter (
Public Frame1 () (
Frame f = new Frame ();
F.setSize (new Dimension (400, 300));
F.setTitle ( "Frame1");
F.addWindowListener (this);
F.setVisible (true);
)
Public static void main (String [] s) (
New Frame1 ();
)
Public void windowClosing (WindowEvent windowEvent) (
System.exit (0);
)
)

/ / 2.4. Indirectly inherited form adapter WindowAdapter
/ / Frame1.java

Import java.awt .*;
Import java.awt.event .*;

Public class Frame1 extends Frame (
Public Frame1 () (
This.setSize (new Dimension (400, 300));
This.setTitle ( "Frame1");
This.addWindowListener (new winAdapter ());
This.setVisible (true);
)
Public static void main (String [] s) (
New Frame1 ();
)
)
(Class winAdapter extends WindowAdapter
Public void windowClosing (WindowEvent windowEvent) (
System.exit (0);
)
)

/ / 2.5. Indirectly achieve WindowListener Interface
/ / Frame1.java

Import java.awt .*;
Import java.awt.event .*;

Public class Frame1 extends Frame (
Public Frame1 () (
This.setSize (new Dimension (400, 300));
This.setTitle ( "Frame1");
This.addWindowListener (new winEventHandle ());
This.setVisible (true);
)
Public static void main (String [] s) (
New Frame1 ();
)
)
(Class winEventHandle implements WindowListener
Public void windowClosing (WindowEvent windowEvent) (
System.exit (0);
)
Public void windowOpened (WindowEvent windowEvent) ()
Public void windowClosed (WindowEvent windowEvent) ()
Public void windowIconified (WindowEvent windowEvent) ()
Public void windowDeiconified (WindowEvent windowEvent) ()
Public void windowActivated (WindowEvent windowEvent) ()
Public void windowDeactivated (WindowEvent windowEvent) ()
)

/ / 2.6. Use Inner Class
/ / Frame1.java

Import java.awt .*;
Import java.awt.event .*;

(Public class Frame1
Public Frame1 () (
Frame f = new Frame ();
F.addWindowListener (new WindowAdapter () (
Public void windowClosing (WindowEvent e) (
System.exit (0);
)
));
F.setSize (new Dimension (400, 300));
F.setVisible (true);
)

Public static void main (String [] s) (
New Frame1 ();
)
)

Server-Side Java with the Struts Framework on Mac OS X

Struts helps you organize your Java-based web applications by providing a framework based on a version of the Model-View-Controller design pattern. With Struts (or more formally, the Jakarta Project’s Struts Framework), you can combine Servlets, JSP, custom Struts tag libraries and other components using a unified framework that helps you design, create, and deploy stable web applications quickly. It requires a bit more work initially, to set everything up, but the value of the framework is realized later, when the ordered and componentized nature of your code lets you maintain, update, and reuse it easily.

Design Patterns and the Model-View-Controller Pattern

Design patterns are conceptual structures that you can use to better organize how you think about, plan, and talk about your code. Many applications, especially web applications, have core elements in common. Design patterns give developers a shared vocabulary, can help keep us from re-inventing versions of the same solutions for each new application.
Apple’s development environments have used the Model-View-Controller pattern for many years. Apple’s documentation includes a discussion of how the Model-View-Controller applies to Cocoa applications.
The Model-View-Controller pattern is used (whether implicitly or explicitly) in nearly every sophisticated web application. It’s a sensible way to organize your application architecture. Simply put, the Model is your data and your application logic, the View corresponds to your presentation elements (HTML, JSP, display beans, etc.), and the Controller(s) handle the application’s flow.


Installing and Using Struts on Mac OS X

To complete the installation steps below, you’ll need items on the Apple Developer Tools CD. So if you haven’t installed it yet, do so now.
To obtain Struts, go to http://jakarta.apache.org/struts/acquiring.html. In these examples, I’m using the current binary distribution, which at the time of this writing is 1.1. If you’re using a later version, then, of course, you’ll have to change some of the paths in the commands below.
First, use curl to download the Struts archive:
liz@localhost:/usr/local/src> curl -O  
http://jakarta.apache.org/builds/jakarta-struts/release/v1.1/jakarta-struts-1.1.tar.gz 
Next, extract the files using gnutar. The version of tar shipped with Mac OS X frequently does not work with tarfiles from the Apache project, but gnutar always will.
liz@localhost:/usr/local/src> gnutar -xzvf jakarta-struts-1.1.tar.gz
Before installing, check Jakarta’s list of prerequisites to make sure you have everything you need.
Struts requires a Java2 Java Development Kit - version 1.2 or later. Since you have installed the Apple Developer Tools, you’re all set. Struts also requires a servlet container. I’ve chosen to use the Apache Project’s Tomcat servlet container, and to run it as a stand-alone server for simplicity’s sake. At the time of this writing, the latest stable version was 4.1.24, although another major version is on the horizion. No matter which version you use, your installation process should be much like mine below.
Since the recent Developer Tools include a JDK greater than 1.4 (type java -version to find out which you have), I can install a lightweight version of Tomcat. I want the server to live under /usr/local/tomcat/, and the source tarball to stay in /usr/local/src.
liz@localhost:/usr/local/src> curl -O http://jakarta.apache.org/builds/jakarta-tomcat-4.0
                              /release/v4.1.24/bin/jakarta-tomcat-4.1.24-LE-jdk14.tar.gz
liz@localhost:/usr/local/src> gnutar -xzvf jakarta-tomcat-4.1.24-LE-jdk14.tar.gz
liz@localhost:/usr/local/src> sudo mkdir /usr/local/tomcat
Password:
liz@localhost:/usr/local/src> sudo mv jakarta-tomcat-4.1.24-LE-jdk14 /usr/local/tomcat
liz@localhost:/usr/local/src> export
CATALINA_HOME=/usr/local/tomcat/jakarta-tomcat-4.1.24-LE-jdk14
liz@localhost:/usr/local/src> cd $CATALINA_HOME/bin
liz@localhost:/usr/local/tomcat/jakarta-tomcat-4.1.24-LE-jdk14/bin> ./startup.sh
Now I can confirm that Tomcat is running on port 8080 on my local machine by going to http://localhost:8080 in a browser:

The next prerequisite is the Ant build system. Note that I’m still using gnutar to extract files, and not Apple’s standard tar executable. I’m installing Ant under /usr/local/ant, and adding its binary files directory to my $PATH environment variable.
liz@localhost:/usr/local/src> curl -O
http://apache.mirrorcentral.com/dist/ant/binaries/apache-ant-1.5.3-1-bin.tar.gz
liz@localhost:/usr/local/src> gnutar -xzvf apache-ant-1.5.3-1-bin.tar.gz 
liz@localhost:/usr/local/src> sudo mkdir /usr/local/ant 
liz@localhost:/usr/local/src> sudo mv apache-ant-1.5.3-1 /usr/local/ant/ 
liz@localhost:/usr/local/src> export ANT_HOME=/usr/local/ant/apache-ant-1.5.3-
liz@localhost:/usr/local/src> export PATH=$PATH:$ANT_HOME/bin/
At this point, if you’ve been following along with me, you’ve set up two environment variables ($CATALINA_HOME and $ANT_HOME) and changed one ($PATH). When you exit your terminal session, these variables will go away. No fun. You’ll probably want to set up a shell startup file that loads these variables for you on each new terminal session. Since I use the bash shell, my startup file lives in /Users/liz/.bash_profile and looks (in part) like this:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices 
export JAVA_HOME=/usr 
export PS1="\u@\h:\w> "
Since I wanted to keep the new environment variables for future use, I changed my .bash_profile to contain the lines below. You can also see that I added aliases for starting and stopping tomcat.
export ANT_HOME=/usr/local/ant/apache-ant-1.5.3-1 
export CATALINA_HOME=/usr/local/tomcat/jakarta-tomcat-4.1.24-LE-jdk14   
export  PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:  
/System/Library/CoreServices:$ANT_HOME/bin   
export JAVA_HOME=/usr   
alias start_tomcat='$CATALINA_HOME/bin/startup.sh' 
alias stop_tomcat='$CATALINA_HOME/bin/shutdown.sh'
If you’re using the bash shell, you can copy and use this file as is. Otherwise, see the manpage for your favorite shell program (for example, man tcsh). To use bash and the .bash_profile file I’m using, open the Terminal application, click Preferences, and set your preferences to be like these:

It’s finally time to install Struts itself. The version of Tomcat I’m using comes with an integrated version of Struts. Still, there are some tag library descriptors and example files that I want to install. Note: If you aren’t using Tomcat (or if you’re using an older version of Tomcat without Struts), follow the Struts installation guide. You’ll just have to copy a few extra files - it’s not much harder.
Here are the commands I used to add the extra Struts files to my new Tomcat installation. Again, if you aren’t using Tomcat with Struts built-in, see the installation link in the line above.
liz@localhost:~> stop_tomcat 
liz@localhost:~> cd /usr/local/src/jakarta-struts-1.1   
liz@localhost:/usr/local/src/jakarta-struts-1.1>   
cp lib/*.tld $CATALINA_HOME/server/webapps/admin/WEB-INF/ 
liz@localhost:/usr/local/src/jakarta-struts-1.1>   
cp webapps/*.war $CATALINA_HOME/webapps 
liz@localhost:/usr/local/src/jakarta-struts-1.1> start_tomcat
With that step completed, you should be able to view the example applications (which came bundled in those .war files referenced above). For example, look at http://localhost:8080/struts-example/index.jsp


”Hello World”
Now we can build a “hello world” mini-application, using a few Struts components. Since the setup process is fairly complicated, this simple application won’t take advantage of many of Struts’ useful features. I’ll focus on those in the next section.
One of the .war files in your Struts source directory is called struts-blank.war. This file is meant to serve as a template for new Struts applications. I want to extract the archive so I can modify it to make my own simple “Hello World” application. So I copy struts-blank.war into a new empty folder, and type jar -xf struts-blank.war. Here are the contents:

You can see that the archive includes the struts.jar file (necessary for any Struts application), some tag libraries, the standard web.xml and manifest files, and a configuration file called struts-config.xml. This config file is actually functionally empty, but it includes lots of useful examples in commented sections.
Let’s look at the other two files in the archive. First, the index.jsp file that comes with the blank Struts application. In this file, you can see the Struts tag libraries in use. (If you aren’t familiar with the taglibs concept yet, you may want to read Sun’s explanation.) One interesting thing to note is that all the English text on the page is stored separately and presented via a custom tag. While this is by no means required in a Struts application, it does simplify Internationalization or text changes. You don’t need to touch any Java components in order to alter the page copy.
<%@ page language="java" %>   
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>   
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>   
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>       
<html:html locale="true">   
<head>   
<title><bean:message key="index.title"/></title>   
<html:base/>    </head>    <body bgcolor="white">       
<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">     
<font color="red">       
ERROR:  Application resources not loaded -- check servlet container      
logs for error messages.     
</font>   
</logic:notPresent>       
<h3><bean:message key="index.heading"/></h3>   
<p><bean:message key="index.message"/></p>       
</body>   
</html:html>
The copy for the file above is stored in ApplicationResources.properties. Since I’m making my own application, I’ll start by altering that text. Here are the contents of my new properties file:
index.title=My Own Hello World, Using Struts  index.heading=Heya
Next, I want to make a simple Java Bean that my application can reference. It’s about as simple as a Bean gets - it stores a hard-coded Magic Number, and tells the user whether or not they guessed that number correctly.
package foo;   
public class GuessBean  
{
public int magicNumber;         
public GuessBean()      
{         
this.magicNumber = 2;     
}       
public String evaluateGuess(int g)      
{        
if (g == this.magicNumber)        
{           
return "You guessed it!";        
}        
else       
{          
return "Sorry, wrong number.";       
}     
}   
}
Now I can edit the index.jsp file and add a basic form, and create a new file called guess.jsp which calls the bean’s evaluateGuess() method. (You can find those files in the hello.war archive.)
The final step is to create a build.xml file that Ant can use to bundle the all application’s files into a WAR archive, and deploy them to Tomcat. If you are using a Java IDE that can build WAR files for you, you won’t need to bother with this section. Otherwise, here’s the build file:
<project name="hello world" default="build-all" basedir=".">     
<property environment="env"/>   
<property name="appname" value="hello"/>   
<property name="src.dir" value="${basedir}/WEB-INF/src"/>   
<property name="app.name" value="hello"/>   
<property name="app.path" value="/${app.name}"/>   
<property name="app.version" value="0.1-dev"/>   
<property name="build.dir" value="${basedir}/build"/>   
<property name="classes.dir" value="${basedir}/WEB-INF/classes"/>   
<property name="tomcat.home" value="${env.CATALINA_HOME}"/>   
<property name="servlet.jar" value="${tomcat.home}/common/lib/servlet.jar"/>   
<property name="deploy.dir" value="${tomcat.home}/webapps"/>           
<path id="build.path">         
<fileset dir="./WEB-INF/lib/">             
<include name="**/*.jar"/>         
</fileset>         
<pathelement path="${src.dir}"/>         
<pathelement path="${servlet.jar}"/>         
<pathelement path="${classes.dir}"/>     
</path>           
<target name="cleanlocal">           
<delete dir="${build.dir}" includeEmptyDirs="true" />           
<delete file="${appname}.war" />           
<mkdir dir="${build.dir}"/>       
</target>                     
<target name="compile">         
<javac   srcdir="${src.dir}" destdir="${classes.dir}" debug="on" deprecation="on">           
<include name="**/*.java"/>           
<classpath refid="build.path"/>         
</javac>       
</target>           
<target name="cleanserver">         
<delete file="${deploy.dir}/${appname}.war" />           
<delete  dir="${deploy.dir}/${appname}" includeEmptyDirs="true" />       
</target>           
<target name="war">           
<war warfile="${appname}.war" webxml="./WEB-INF/web.xml">                  
<fileset dir="./" includes="**/*.*" excludes="*.war, **/*.nbattrs,
.xml, **/WEB-INF/**/*.*, **/project-files/**/*.*"/>                  
<webinf  dir="./WEB-INF"    includes="**/*" excludes="web.xml,                    
**/*.jar, **/*.class"/>                  
<lib dir="./WEB-INF/lib"/>                  
<classes dir="${classes.dir}" cludes="**/*.properties, **/*.class" />           
</war>       
</target>           
<target name="build-all" depends="cleanlocal, cleanserver, compile, war">         
<copy file="${appname}.war" todir="${tomcat.home}/webapps"/>       
</target>    
</project>
To deploy my new application, I simply need to run Ant and restart Tomcat.
liz@localhost:~/hello> ant  liz@localhost:~/hello> stop_tomcat 
liz@localhost:~/hello> start_tomcat

Sample Application: A RSS Newsfeed Consolidator

Many news sites and weblogs make their headlines available as RSS feeds. The RSS format is (more-or-less standardized) XML, generally made available over HTTP. You can read more about RSS, for example, on the O’Reilly xml.com site and the webreference.com site (and elsewhere).
In this section, I’ll show you how you can use Servlets, JSP, and Struts to create an application that will allow a user to log in, assemble a list of weblogs and/or news sites, and read headlines fetched and displayed by the application. Headlines are links to the remote content. For simplicity’s sake, I’ve left off several real-world aspects of the application, most notably the database backend. User data is simply stored in the session, and vanishes when the user closes their browser or you re-start Tomcat.
Let’s look at the application with the Model-View-Controller design paradigm in mind. In this case, the model is the session data plus the application logic. The view corresponds to the JSP pages and beans used for display, and the controller is a special SiteAction class. The SiteAction class is a subclass of a Struts Action class, and it is responsible for handling user input and dispatching requests to the correct places. Here’s an overview of the files which make up the application. (You can download the WAR file and a tarball of the whole application.)

In this application, I want to take advantage of a few of Struts’ cooler features. For instance, I can create custom Form Beans and tie them to Action objects. Let’s start with a Form Bean. The bean’s properties map to form fields, and each property has appropriately-named accessor methods.
package foo;   
import javax.servlet.http.HttpServletRequest; 
import org.apache.struts.action.ActionError; 
import org.apache.struts.action.ActionErrors; 
import org.apache.struts.action.ActionForm; 
import org.apache.struts.action.ActionMapping;   
public final class SiteForm extends ActionForm  
{           
private String index = null;     
private String url = null;     
private String title = null;     
private String dispatch = null;      
// accessor methods       
public void setUrl(String url)      
{         
this.url = url;     
}       
public void setTitle(String title)      
{         
this.title = title;     
}       
public void setIndex(String index)      
{         
this.index = index;     
}       
public void setDispatch(String dispatch)     
{         
this.dispatch = dispatch;     
}       
public String getUrl()      
{         
return (this.url);     
}       
public String getTitle()      
{         
return (this.title);     
}       
public String getIndex()      
{         
return (this.index);     
}       
public String getDispatch()     
{         
return (this.dispatch);     
}       
public void reset(ActionMapping mapping, HttpServletRequest request)      
{        
this.url = null;        
this.title = null;        
this.index = null;     
}     
// for this application, we aren't validating user input, but you could easily extend      
this method to do form validation public ActionErrors validate(ActionMapping mapping,                                  
HttpServletRequest request)      
{       
// I'm leaving this example code in place so you can        
see how form validation would be done using Struts           
ActionErrors errors = new ActionErrors();        
// if (url == null)          
//    errors.add("url", new ActionError("error.url.required"));         
return errors;       
}  
One of the most interesting things about Struts is its set of Action classes. The code below extends the Struts Action class, and uses simple conditionals to dispatch user requests. There are other kinds of Action classes, notably DispatchAction, which you can read about in the Struts user guide and on Ted Husted’s husted.com.
// this controller responds to user input, handles it, and redirects  
// to a location specified in struts-config.xml  package foo;     
import java.io.IOException;  import java.util.Vector; 
import javax.servlet.RequestDispatcher; 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpSession; 
import javax.servlet.http.HttpServletResponse; 
import org.apache.struts.action.Action; 
import org.apache.struts.action.ActionError; 
import org.apache.struts.action.ActionErrors; 
import org.apache.struts.action.ActionMapping; 
import org.apache.struts.action.ActionForm; 
import org.apache.struts.action.ActionForward;   
public final class SiteAction extends Action
{       
public ActionForward perform(ActionMapping mapping,                  
ActionForm form,                  
HttpServletRequest request,                  
HttpServletResponse response)     
throws IOException, ServletException      
{       
ActionErrors errors = new ActionErrors();     
// get the RSS Site List object from the session,       
or create a new one if necessary     
HttpSession session = request.getSession();     
SiteList siteList = (SiteList)session.getAttribute("siteList");     
if (siteList == null)     
{         
siteList = new SiteList();     
}       
String dispatch = ((SiteForm) form).getDispatch();       
String forward = "alter";       
if ("add".equals(dispatch))      
{         
String url = ((SiteForm) form).getUrl();         
String title = ((SiteForm) form).getTitle();         
if (url != null && title != null)         
{             
SiteListItem it = new SiteListItem();             
it.setURL(url);             
it.setTitle(title);             
siteList.addSite(it);         
}     
}     
else if ("show".equals(dispatch))      
{         
String index = ((SiteForm) form).getIndex();         
if (index != null)         
{             
// put the selected site index in the              
session for use by the next page             
session.setAttribute("siteIndex",index);             
forward = "view";         
}     
}     
else if ("delete".equals(dispatch))     
{         
String index = ((SiteForm) form).getIndex();         
if (index != null)         
{             
int ind = Integer.parseInt(index);             
siteList.removeSite(ind);         
}     
}       
// Forward to the specified success URL      
return (mapping.findForward(forward));     
} 
}
At this point, we tie the Action and Form objects together using directives in struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>   
<!DOCTYPE struts-config PUBLIC           
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"           
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"> 
<struts-config>     
<!-- ========== Form Bean Definitions =================================== -->   
<form-beans>       
<!-- our SiteList controller -->     
<form-bean name="SiteForm" type="foo.SiteForm"/>       
</form-beans>       
<!-- ========== Action Mapping Definitions ============================== -->   
<action-mappings>       
<action path="/siteAction" type="foo.SiteAction" name="SiteForm">        
<forward name="alter" path="/index.jsp"/>        
<forward name="view"  path="/show.jsp"/>     
</action>       
</action-mappings>   
</struts-config
Now we can use Struts to create a JSP page with user input elements that call the SiteAction object.
<%@ page language="java" %> 
<%@ page import="foo.SiteListItem" %> 
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>   
<head> 
<title>Manage Sites</title> 
<html:base/> 
</head> 
<body bgcolor="white">   
<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">   
<font color="red">
ERROR:  Application resources not loaded -- check servlet container     
logs for error messages.</font> 
</logic:notPresent> <br />   
<jsp:useBean id="login" scope="session" class="foo.LoginBean" />   
<jsp:useBean id="siteList" scope="session" class="foo.SiteList" />   
<h1>RSS Site Manager</h1>   
<%// user validation is being handled by a session bean if (login.validate() == false)     
{        
out.println("<script language=\"javascript\">         
document.location='/headlines/login.jsp'</script>");       
return;     
}        
int size = siteList.getSize();       
for (int i=0; i < size; i++)     
{         
SiteListItem it = siteList.getItemAt(i);         
out.println("<a href=\"/headlines/siteAction.do?dispatch=show&index="           
+ i + "\">" + it.getTitle() +            "
</a><br>");     
}   
%> 
<br> 
<hr> 
<h2>Add a Site</h2> 
<html:form type="foo.SiteAction" name="SiteForm" action="/siteAction.do" focus="url"> 
<table border="0"><tr>     
<td>RSS URL</td>     
<td><input type="text" name="url" size="60"/></td>  </tr>  <tr>     
<td>Title</td>      <td><input type="text" name="title" size="60"/></td>   
</tr>  <tr>      <td colspan="2"> <input type="submit" value="Submit"/></td>  </tr>   
</table>  <input type="hidden" name="dispatch" value="add">  </html:form>  </body> 
</html:html>
These files work together with beans that store and parse the list of RSS links and manage user login. Those helper objects are available in the tar archive. Note that in a production-quality application, user logins would have been handled by an Action object instead of the lightweight bean I’m using for example purposes.

With all these pieces assembled, you can compile and deploy the application using the same build.xml file referenced above. Just change the project name and appname at the top of the file, and you’re good to go. Here’s the RSS manager in action:

Conclusion, and Suggestions for Further Reading

This article has given you the information you need to get up and running with Struts on Mac OS X. Still, there’s much more to Struts than I can cover in one article. If you’re interested in learning more, visit the Struts User Guide. You might also want to pick up Programming Jakarta Struts, by Chuck Cavaness, or Struts in Action, by Ted Husted. Finally, I would be remiss in not recommending the now-classic book Design Patterns: Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson, and Vlissides.