text:
Talk:Main Page/test

2007 New main page layout with details of books
Comments? See also Nearly_complete, ideally this would be the source for "Some excellent Wikibooks that are complete or nearly complete". RobinH 19:46, 18 February 2007 (UTC)

 * The problem with the improvements is that they have hiddent the books! RobinH 11:45, 19 February 2007 (UTC)

 * The books weren't hidden they were made to show in a fixed area and scroll. I've tried something else now. Each time it loads shows a different good book. --dark [[Image:Yin yang.svg|12px]] lama 22:58, 19 February 2007 (UTC)

 * I am worried that this approach is hiding what we do at Wikibooks. We create books to be read.

 * Here are some examples of commercial ebook sites:

 * http://www.ebooks.com/

 * http://www.free-ebooks.net/

 * http://www.gutenberg.org/wiki/Main_Page

 * http://www.ebookimpressions.com/

 * They tend to show their books as the most important feature.
 * RobinH 11:23, 20 February 2007 (UTC)

 * I really don't like the way the books are presented. Thats why I changed it previously and was trying different things. I believe the "library catalog" should remain side by side with the welcome box as it was previously. I was trying to make the "featured books" more consistent with how websites such as those listed above do so. None that I could tell, present as many featured books, do so without an image for the book, divide the books into subsections on the front page, or make there list of book categories completely unaccessible without scrolling. In other words, I don't think the changes make it look any more like a professional ebook website.
 * To me it looks like you may of just simply reverted back to an earlier version. I'm worried that the current state of this module looks unprofessional and wonder whats the points in trying to show our best books if we also don't show our best in designing the front page. I really didn't want to have to say anything like this and I hope it doesn't come off the wrong way. I prefer do or improve than explain why I don't like something. --dark [[Image:Yin yang.svg|12px]] lama 13:32, 20 February 2007 (UTC)

 * This is just a test page and the list of books that I have included definitely needs an improved presentation, as you say. At present there are only about 40 books that could qualify as "nearly complete". I would like to suggest that we use this moment, when there are not many good books, to work out how to display books so that readers are attracted to them.  In 6 months to a year we will need to have displays of books in the individual departments and only a few featured books on the front page.  However, at this moment we have the opportunity to work out how to display individual books on the front page itself.  We can then use this method of display later in the individual departments.

 * So, what I am asking is that you, or someone else who is good at laying things out, should work out a way of displaying individual books. Obviously this should involve a picture and a summary but should be neater and prettier than my crude table! RobinH 15:33, 20 February 2007 (UTC)

(reset indent) Derbeth made the following comment: First of all, the table with "excellent books" (is "excellent" the best word? Aren't we exaggerating?) leaves too much space in left and right; this looks odd. Perhaps the solution is to make a two-column layout to use all of existing space? Look how long is the page now; it should be not like that, especially when category selection is deep on the bottom.

Secondly, I don't think that putting PDF's in front is a good idea. We are wiki and should be focused on wiki materials. PDF's are: inconsistent in look, require user to download a large ammount of data at once, may be seriously outdated and are something "external" to our project (internal links, categories do not work). I think that part of Wikipedia success is that you read and simultaniously fix mistakes you find. Showing out non-editable form of our books would be a shot in our foot in my opinion. So, the order should be the opposite: book titles should lead to books on our wiki (cover pages when possible), and links to PDF versions should be given as an option.

Less important things: table with Wikijunior books has an inconsistent look with the rest of the page. "Search and browse" with category selection together with list of sister projects leave to much white space on left and right. They should be aligned more horizontally; be wider but lower.

Things I particularly like are book descriptions with cover images; this brings some diversity to the main page. --Derbeth talk 15:28, 20 February 2007 (UTC)

 * Yes, we have to "lay out our stall" to be successful. We need to implement your suggestions:

 * 1. Replace "excellent etc."

 * 2. Make the display 2 column

 * 3. Make the link to the editable version with a "(PDF)" link. ie: "Special relativity  [[Media:special relativity.pdf|(PDF)]]"

 * 4. Wikijunior should have same layout.

 * Good ideas. Unfortunately (or fortunately from my point of view!) I am just about to go on holiday. RobinH 15:45, 20 February 2007 (UTC)

Using columns?
I like the idea of using two columns on the main page. Instead of the current setup, we could have the "Welcome!" message on the left, and a list of books on the right (likely a partial, randomly generated list of books, instead of the complete list). At the bottom we could have then the links to our bookshelves, and then the links to the sister projects. --Whiteknight (talk) (projects) 18:53, 20 February 2007 (UTC)

 * I rather see welcome and the bookshelves at the top for the left and right column for the first row, followed by a partial and randomly generated list of books following using two columns followed by the sister projects links last. Neither the welcome nor bookshelves take up much screen space and should be easily accessible from the top. --dark [[Image:Yin yang.svg|12px]] lama 19:21, 20 February 2007 (UTC)

Current Version
I really like the current version, With the two columns up top, the 2x2 grid of books underneith, and then the sister project links. It looks very good on this screen, but I am currently on a wide-aspect screen, so more things are showing then they would on a smaller screen (the lab on campus has very large monitors). I think we are definately moving in the right direction. All we need now is to write short summaries of all our good books! --Whiteknight (talk) (projects) 21:50, 20 February 2007 (UTC)

The current version looks better. However, with only 40 completed books we could, and should, put all of these books on the front page. I have provided an example in the Humanities and Arts department of how the departmental pages might be arranged if only a short listing of books is provided on the main page. Each department would have a full list of its best books up front. Eventually this might be extended into the page for each subject area with only the best at the departmental level. (The list of books in the arts dept is not complete) RobinH 11:30, 21 February 2007 (UTC)

 * I like that idea alot! every department should contain, right on the bookshelf, listings of the best books. This could include little blurbs like cover images and summaries. If we had a standardized system for displaying these blurbs, it would be a trivial matter for a bot to read them, and create templates for inclusion on the main page. --Whiteknight (talk) (projects) 14:48, 21 February 2007 (UTC)

 * While I'm thinking about it, i'm going to create a suitable template for this. Book blurbs like this could be written in the template, and then all references to that template on the bookshelves could be easily picked out by a human or a bot, for inclusion on the main page. --Whiteknight (talk) (projects) 14:52, 21 February 2007 (UTC)

 * I like the look of the proposed front page listed here, and i also believe that this is the way forward. I think that giving each bookshelf it's own set of featured books as demonstrated at the arts and humanities departments would be a great help to the project and would ake it more accessible to those who wish to read rather than edit, whilst still maintaining the editor functionality. Urbane User   (Talk)   (Contributions)  16:10, 21 February 2007 (UTC)

 * I'm only quickly scanning the comments here, but I like Urbane's idea of having some good book for each bookshelf, at least for the most part. I like this page a lot and think it looks nice. I'd have no problem with it becoming the new main page if we could add a few more good books to it. -within focus 16:13, 25 February 2007 (UTC)

→ tab reset

I think we should restrict books listed on the main page to one book per department in order to show that Wikibooks has a broad range of textbooks. Each department could pick what books to show on its department page and than one book picked from that list could be used for the main page. Alternatively each time the page is loaded a different book is picked from the books listed on a department page. --dark lama  16:52, 25 February 2007 (UTC)

 * Why? When there are so few completed books we could list them all. RobinH 13:28, 13 April 2007 (UTC)

 * I have had a go at a layout, attempting to take onboard the comments and criticisms displayd on this page. Could people please take a look and comment. Thanks. It can be found at: User:Urbane/Sandbox. Urbane   (Talk)   (Contributions)  15:45, 16 April 2007 (UTC)

 * I really like that version! Dedicating the whole right side of the page to completed books, and the left side to navigation is a good idea and it guarantees that books will be immediately visible for the readers. I would like to see the headline changed from "Completed Books" to "Good Books", but that's a minor complaint. --Whiteknight (talk) (projects) 15:54, 16 April 2007 (UTC)
 * Minor - doesn't render in my firefox at least - I get one column above another one offset (looks good tho) -- Herby talk thyme 15:58, 16 April 2007 (UTC)

 * I'm doing it in firefox too, and I dont see an issue like that. --Whiteknight (talk) (projects) 16:05, 16 April 2007 (UTC)
 * I take that back, when i adjust the size of the window it doesnt render properly anymore. Maybe make it a table instead of floating divs? --Whiteknight (talk) (projects) 16:06, 16 April 2007 (UTC)

 * I have converted it to a table, does the page still render incorrectly for you? Urbane   (Talk)   (Contributions)  16:25, 16 April 2007 (UTC)

 * It renders fine now. --Whiteknight (talk) (projects) 16:35, 16 April 2007 (UTC)

 * I think the "completed books", "features books" and "wikijunior book of the quarter" should all be on the right side. Books are always evolving and never in a state of completion. Featured books is the name of the project, so that should be the heading given to it. I think the edit column should be removed. I don't think the link to test2 makes sense, it was never intended to replace the community portal or directed at contributors only as seems to be implied. Other then that I agree it looks good. --dark [[Image:Yin yang.svg|12px]] lama  16:22, 16 April 2007 (UTC)

 * Renders fine now - full & windowed (at home, I'll try work tomorrow). The "sister projects" section looks a little odd as it "unbalances" the columns?  Good tho -- Herby  talk thyme 17:03, 16 April 2007 (UTC)

 * Looks good to me as well. Why not transfer it to here and to the main page? RobinH 09:42, 18 April 2007 (UTC)

 * I've gone ahead and transfered the contents of Main Page/test2 to the main page since its not so different from what was already the main page, the basic layout seems to be agreed on and Urbane's version seems to still need some work. At least this way in the mean time there are more featured books on the main page and its only a matter of editing Template:Main Page featured books to whatever gets agreed to. --dark [[Image:Yin yang.svg|12px]] lama 12:19, 18 April 2007 (UTC)
 * ! It looks good! --Remi 12:23, 18 April 2007 (UTC)

 * Agreed, good change, and it gives us time to really get a better version ready, if we still want to make improvements. Small steps forward are always better then nothing at all. --Whiteknight (talk) (projects) 12:49, 18 April 2007 (UTC)

title: Talk:Main Page/test


text:
Intelligence Intensification/General Tips For Practicing

Information Ecology Practices

 * Principle 4: understanding is enhanced by intelligent practice

The transition to a knowledge-based digital environment has been vital to the transformation of the nature of information ecosystems and a global dynamic of the intensification of intelligence. The emerging holistic life science of Information ecology incorporates principles, disciplines and protocols that facilitate the emergence of a common collective intelligence:

 * Be mindful that information has:

 * Zero mass

 * Zero physical size

 * Virtually zero travel time

 * Be mindful that these zero-based properties - combined with advances in technology - open up a new, infinite, digital universe

 * Discover how information properties make possible - as never before - a new digital commons and

 * Enable common access to properties of the whole

 * Be mindful of the power of zero

 * addition & subtraction - it does nothing

 * multiplication - reducing any number to zero

 * division - raising any number to an immeasurable, infinite number

 * exponential power - bringing all numbers to one

 * Be mindful of zero's synonyms: nothing, none, null, empty, void, the unknown

 * Be mindful that information obeys the following principles:

 * value is enhanced by intelligent organization

 * management is enhanced by intelligent protocols

 * flow is enhanced by intelligent networks

 * understanding is enhanced by intelligent practice

 * Observe the intelligence and value of each information ecosystems with which you interact

 * Pay attention to the boundaries of information ecosystems

 * Pay attention to the interactions between information ecosystems

 * Discern and observe the architecture of information ecosystems

 * Be mindful of endangered information species and patterns of dominance

 * Observe your organization's information habitats and their dynamics. Are they in design and use?

 * Engage in an ongoing collective process of observing, enhancing and fine tunic the internal flow of information

 * Observe your personal information habitats. Are they for you?

 * Integrate, enhance and fine tune your personal information habitats

 * Seek virtually effortless interaction with your information habitats

 * Focus on hand and eye movement alone

 * Save keystrokes whenever possible

 * Align in style with cascading styles

 * Observe the Tao of information

 * Choose Wikibooks as your default platform for writing

Doing One Thing At a Time
In karate, practicing the basic strike demands that

 * 1) The opponent should be vividly imagined
 * 2) The look should be steady and directed to the chest of the imagined opponent
 * 3) The elbow of the arm not striking should strike backwards with equal force
 * 4) The hip should rotate in order to enhance the strike
 * 5) The exhale should take place in the moment of impact
 * 6) The wrist must be straight during the strike
 * 7) The arm should not be streched out entirely (in order not to wear out the elbow joint)
 * 8) The fist should rotate just before the moment of impact

Having all this in mind when practicing is very difficult. A better idea is to concentrate on one thing at a time. Iterate over the list of things to practice. Let the other things happen by themselves or go wrong, as the case may be. This method of practicing is of course applicable in all kinds of training.

Choosing to Focus on the Practice
Another useful technique to use when practicing, also inspired by martial arts, is to enter a meditation position before and after the training.

Before the training, enter the position and

 * 1) Consciously remind yourself that you choose to do this training
 * 2) Affirm that you will be concentrated and use the time effectively
 * 3) Visualize yourself doing what you are going to do, feel that you are relaxed and that it is fun to practice

After the training, enter the position and

 * 1) Visualize what you practiced and visualize yourself doing everything perfectly
 * 2) Thank yourself for being concentrated and feel the joy of development

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Talk:Intelligence Intensification/The Theoretician Versus the Practician

Is this page really necessaru? Is it valueable? --DanielJanzon 00:50, 8 Apr 2004 (UTC)

What does "???6=7" mean and why is it there? Lukys (discuss • contribs) 19:36, 17 February 2012 (UTC)


text:
User:DanielJanzon

I'm Daniel Janzon, 22. I recently started writing Intelligence Intensification, perhaps the most important subject for humanity.

My interests are, among other things,

 * 1) Mathematics
 * 2) Physics
 * 3) Computer programming
 * 4) Surviving, especially the reactions in my organism when luxory is not present
 * 5) Karate, am training at the local club
 * 6) Pistol shooting, currently no training, but I find the subject extremely interesting
 * 7) Walking, at least one hour of walking a day
 * 8) Looking at art, everything that is new, love modern art
 * 9) Music
 * 10) Dreams, being aware in them
 * 11) Politics, believe most things in society is handled in the wrong way
 * 12) Literature, love Dostoyevsky, Douglas Adams, and many others
 * 13) Short finite projects, like learning to juggle, learning to walk on the hands, etc

title: User:DanielJanzon


text:
Talk:Electronics/Capacitors

Thanks, Wanderer!

Someone should lay off on the big worded talk later down the page when talking about permeability.

In the common case of an isotropic medium, D and E are parallel and ε is a scalar, but in more general anisotropic media this is not the case and ε is a rank-2 tensor (causing birefringence).

isotropic? birefringence? rank-2 tensor? anisotropic media?

RC circuit drawings are incorrect
The circuit drawings for RC circuit portion of the article are incorrect. One of two things can be done to fix these: (1) replace the battery with a current source or (2) keep the battery but put all the components in series. I recommend option (2) as a battery is more familiar than a current source. Alfred Centauri 01:35, 31 May 2005 (UTC)

Pros & cons of different capacitor technologies
Different capacitor types have inherent characteristics which make them unsuitable or less desirable for certain applications. It would be useful to list both pros and cons for electrolytic, ceramic, mica, paper, tantalum, aluminum-Mylar, and other types of capacitors. As a 25+ year electronic design engineer, I am frequently amazed how even my fellow electrical engineers are unaware of these factors. It's not an area typically covered in undergraduate engineering programs, and the better engineers acquire this knowledge on the job over a five- to ten-year period. --QuicksilverT @ 19:58, 5 December 2005 (UTC)

Electrolytic pics are bad
I don't like the electrolytic picture, it (the caption) doesn't say which one is radial and which is axial, and the leads are shown of equal length, which is incorrect. I may post something on this if it is ok.66.75.230.103 06:32, 10 December 2005 (UTC)

equivalent series resistance
This module mentions
 * ESR or "equivalent series resistance" (explained above).

but alas, I don't see any explanation of it, either "above" or "below" that mention. Has the ESR explanation been accidentally deleted? --DavidCary (talk) 16:14, 2 September 2008 (UTC)

which capacitor information goes where
I think somewhere we should mention "surge current" ratings. In particular, the fact that tantalum capacitors can fail and become a short circuit if their surge current is exceeded.

But should I mention that in Electronics/Capacitors, Electronics/Component Identification, or Electronics/Capacitor Construction ? --DavidCary (talk) 01:50, 17 October 2008 (UTC)

title: Talk:Electronics/Capacitors


text:
Talk:Electronics/Frequency Spectrum

Perhaps we scrap the sound section, and other undesirables, yes?

Sound has a long history in Electronics components (microphone, speaker). It has bandwidth and serves as a good analogy to light that people can relate to. As for light, well there is radio and TV among other things. I have removed the pop cultural references so this should hopefully address your concerns about undesirables.

X ray laser
Thanks a lot for this article, i've been looking for a long time for this information. However i don't think is actualized, ti would be amazing if in the x ray segment would explain the new x ray lasers and why it can't be an gamma ray laser. Since i'm not a physicist (or a scientists either) may be there is a reason for it, then accept my excuses in advance for my ignorant comment :-) Thanks! Jairo

title: Talk:Electronics/Frequency Spectrum


text:
Electronics/Vacuum Tubes

Background
The first vacuum tube diodes were created by Thomas Edison in 1904. These initial tubes could only be used for rectification. The triode, which allowed for voltage and power amplification, was invented 3 years later in 1907 by Lee De Forest.

Vacuum tubes are also referred to as thermionic tubes, thermionic valves, electron tubes, valves and just plain tubes.

While, for most electronics, vacuum tubes have been replaced by transistors, there are still some uses for which vacuum tubes are desired. Vacuum tubes are frequently used in high end Hi Fi amplifiers and are generally desirable over transistors for their "warmer" tone. They are also generally preferred in guitar amplifiers both for their smoother clipping in overdrive and the warmer tone.

Finally, vacuum tubes are used in high frequency communications (at frequencies that would destroy solid state components) as well as satellite and military communications due to their durability (they stand up to solar radiation better than solid state and are immune to electromagnetic pulse).

Passive Versus Active Components
Passive components have no gain and are not valves

 * Voltage Regulator: an active component which accepts a range of voltages and outputs one constant voltage.

Vacuum Tube Basics
A Vacuum Tube is a container (usually of glass) from which the air is removed. Inside the tube are two or more "Elements".

- Cathode: (electron emitter) has an electrically heated filament (which you can usually see glow red ) which spits out electrons that travel through the vacuum to the Anode (electron acceptor).

- Anode (a.k.a. Plate): Is a conductive (usually metal) plate that is connected to a positive voltage. The negative electrons flow from the Cathode to the Anode.

A vacuum tube with just Cathode and Anode elements is a DIODE. Current will flow only when the Anode has a positive voltage relative to the Cathode.

- Grid(s): metal gratings or grids are placed between the Cathode and Anode to produce devices that can amplify signals.

NOTE: A tube with 3 elements (one grid) is a TRIODE, with 2 grids a TETRODE, with 3 grids a PENTODE.

A Grid between the cathode and anode controls the flow of electrons. By applying a negative voltage to the grid it is possible to control the flow of electrons. This is the basis of the Vacuum Tube amplifier.

Vacuum tubes contain heater filaments. These are similar to the filaments one would find in a standard light bulb. The filaments usually run at low voltages (6V and 12V are common, though tubes can be found with a variety of filament voltages). The filament is surrounded by a cathode. The filaments are constructed of heat the cathode to about 800 degree Celsius, at which point the cathode begins to emit electrons. The electrons normally float on the surface of the cathode and this is called a space charge. The anode is generally kept more positive than the cathode and so it draws the electrons off of the cathode.

The voltage difference in the direction from the cathode to the anode is known as the forward bias and is the normal operating mode. If the voltage applied to the Anode becomes negative relative to the Cathode, no electrons will flow. In electronics vacuum electron tube or valve is a device that controls current. Through a vacuum in sealed container. Vacuum tubes rely on thermionic emission of electrons from hot filament.

Tube Characteristics
Below is an explanation of various tube parameters:

Diodes

Vacuum tube diodes contain only two electrodes (besides the heater): A cathode and an anode. The filament heats up the cathode, producing a space charge. A relatively positive voltage on the anode then draws electrons from the cathode to the anode, producing the one way current of a diode. Current will not flow from anode to cathode.

As with silicon diodes, vacuum tube diodes can be used for various functions. They can be used in voltage multipliers, envelope detectors, and rectifiers, for example.

Common rectifier tubes are: 5AR4/GZ-34, 5V4-GA, GZ37, 5U4-G/GA/GB, 5Y3-G/GA, 5R4GYB, and 5R4-G/GY/GYA. Different rectifier tubes have different maximum voltages, current ratings and forward voltage drops. Some have 5V filaments and others 6.3V. And some draw more filament current than others.

Some rectifiers are half-wave (single diode) and some are full-wave, containing a single cathode, but two anodes, one for each half of the wave, as shown in the Full-wave rectifier image to the right.

Klystron
A klystron is a vacuum tube used for production of microwave energy. This device is related to but not the same as a magnetron. The klystron was invented after the magnetron.

Klystrons work using a principle known as velocity modulation.

The klystron is a long narrow vacuum tube. There is an electron gun (heater, cathode, beam former) at one end and an anode at the other. In between is a series of donut shaped resonant cavity structures positioned so that the electron beam passes through the hole.

The first and last of the resonant cavities are electrically wired together.

At the cathode the electron beam is relatively smooth. There are natural slight increases and decreases in the electron density of the beam. As the beam passes through the holes of the resonant cavities, any changes in the electron beam cause some changes in the resting electro magnetic (EM) field of the cavities. The EM fields of the cavities begin to oscillate. The oscillating EM field of the cavities then has an effect on the electrons passing through, either slowing down or speeding up their passage.

As electrons are affected by the EM field of the first cavity they change their speed. This change in speed is called velocity modulation. By the time the electrons arrive at the last cavity there are definite groups in the beam. The groups interact strongly with the last cavity causing it to oscillate in a more pronounced way. Some of the last cavity's energy is tapped off and fed back to the first cavity to increase its oscillations. The stronger first cavity oscillations produce even stronger grouping of the electrons in the beam causing stronger oscillations in that last cavity and so on. This is positive feedback.

The output microwave energy is tapped of for use in high power microwave devices such as long range primary RADAR systems.

The klystron is a coherent microwave source in that it is possible to produce an output with a constant phase. This is a useful attribute when combined with signal processing to measure RADAR target attributes like Doppler shift.

Related microwave vacuum tubes are the Travelling Wave Tube (TWT) and the Travelling Wave Amplifier (TWA). A Hybrid device, which combines some aspects of these devices and the klystron, is a device called a Twicetron.

Magnetron
Magnetrons are used to produce microwaves.

This is the original device used for production of microwaves and was invented during the Second World War for use in RADAR equipment.

Magnetrons work using a principle known as velocity modulation.

A circular chamber, containing the cathode, is surrounded by and connected to a number of resonant cavities. The walls of the chamber are the anode. The cavity dimensions determine the frequency of the output signal. A strong magnetic field is passed through the chamber, produced by a powerful magnet. The cathode is similar to most thermionic valves, except heavy, rigid construction is necessary for power levels used in most Magnetrons. Early, experimental designs used directly heated cathodes. Modern, high powered designs use a rigid, tubular cathode enclosing a heater element.

Naturally excited electrons on the surface of the cathode are drawn off, into the chamber, toward the outer walls or anode. As the electrons move out, they pass through a magnetic field that produces a force perpendicular to the direction of motion and direction of the magnetic field. The faster the electrons move, the more sideways force is produced. The result is that the electrons rotate around the central cathode as they move toward the outside of the chamber.

As electrons move past the entrances to the resonant cavities a disturbance is made to the electro magnetic (EM) field that is at rest in the cavities. The cavity begins to oscillate. When another electron moves past the cavities, it also interacts with the internal EM field. The motion of the electron can be slowed or sped up by the cavity field. As more electrons interact with the cavity EM fields, the internal cavity oscillations increase and the effect on the passing electrons is more pronounced.

Eventually, bands of electrons rotating together develop within the central chamber. Any electrons that fall behind a band are given a kick by the resonant cavity fields. Any electrons going too fast have their excess energy absorbed by the cavities. This is the velocity modulation effect. The frequency of the resonance and electron interaction is in the order of GHz. (10^9 cycles per second)

In order to have a signal output from the magnetron, one of the cavities is taped with a slot or a probe to direct energy out into a waveguide for distribution.

Magnetrons for RADARs are pulsed with short duration and high current. Magnetrons for microwave ovens are driven with a continuous lower current.

The magnetrons for WWII bombers, operated by the RAF, were sometimes taped into a shielded box so that the aircrew could heat their in-flight meals, hence the first microwave ovens.

Cathode Ray Tube
A cathode ray tube or CRT is a specialized vacuum tube in which images are produced when an electron beam strikes a phosphorescent surface. Television sets, computers, automated teller machines, video game machines, video cameras, monitors, oscilloscopes and radar displays all contain cathode-ray tubes. Phosphor screens using multiple beams of electrons have allowed CRTs to display millions of colors.

The first cathode ray tube scanning device was invented by the German scientist Karl Ferdinand Braun in 1897. Braun introduced a CRT with a fluorescent screen, known as the cathode ray oscilloscope. The screen would emit a visible light when struck by a beam of electrons.

TV Tubes
TV tubes are basically cathode ray tubes. An electron beam is produced by an electrically-heated filament, and that beam is guided by two magnetic fields to a particular spot on the screen. The beam is moved so very quickly, that the eye can see not just one particular spot, but all the spots on the screen at once, forming a variable picture.
 * Colours are produced by having 3 or more differently coloured screen spots activated at once to a variable degree.

The 2 magnetic fields are one for the vertical deflection, one for the horizontal deflection, and they are provided to the beam by external coils.

Oscilloscope Tubes
Oscilloscope tubes are basically the same as TV tubes, but the beam is guided by two electrostatic fields provided by internal pieces of metal. It is a necessity because an oscilloscope uses a very large range of synchronisation frequencies for the deflection, when a TV set uses fixed frequencies, and it would be too difficult to drive large coils on a so large band of frequency. They are much deeper for the same screen size as a TV tube because the deflection angle is little. A TV tube has a deflection angle of 90° for the be

title: Electronics/Vacuum Tubes


text:
Cookbook:Samosa

| Cuisine of India | Vegan cuisine

Ingredients

 * ¼ kg potatoes
 * Green peas combined
 * 2 onions, sliced
 * 2 green chiles, chopped
 * Spices (optional)
 * 2 mint leaves
 * 2 sprigs of cilantro (coriander)
 * Maida (all-purpose flour)
 * Water
 * Olive oil or vegetable oil
 * Salt
 * Vegetable oil, for deep frying

Procedure

 * 1) Steam the potatoes and peas separately. Cut the potatoes into small pieces.
 * 2) Heat a dash of olive oil in a frying pan. Add onions and chilis, and sauté until the onions turn transparent.
 * 3) Add the potatoes, peas, and spices. Sauté them while stirring until they are completely cooked.
 * 4) Add mint leaves, and coriander leaves.
 * 5) Mix the flour with enough water to make a stiff dough. Knead in 1 tablespoon of oil and a pinch of table salt. Knead it well.
 * 6) Roll dough into even-sized balls (about 3.5 cm in diameter) and roll them out into circles using a rolling pin.
 * 7) Cut each circle in half to make semi-circles.
 * 8) Place a spoonful of the vegetable mixture onto the dough semi-circles, and fold on three sides to make each one into a pyramid shape.
 * 9) Deep fry the samosas until golden and crispy.

Notes, tips, and variations

 * Multiple variations are possible for filling. Lamb and other meats work well with samosa, as do peppers, rice, paneer and mince (keema).

title: Cookbook:Samosa


text:
Electronics/DC Circuit Analysis

DC Circuit Analysis
In this chapter, capacitors and inductors will be introduced (without considering the effects of AC current.) The big thing to understand about Capacitors and Inductors in DC Circuits is that they have a transient (temporary) response. During the transient period, capacitors build up charge and stop the flow of current (eventually acting like infinite resistors.) Inductors build up energy in the form of magnetic fields, and become more conductive. In other words, in the steady-state (long term behavior), capacitors become open circuits and inductors become short circuits. Thus, for DC analysis, you can replace a capacitor with an empty space and an inductor with a wire. The only circuit components that remain are voltage sources, current sources, and resistors.

Capacitors and Inductors at DC

DC steady-state (meaning the circuit has been in the same state for a long time), we've seen that capacitors act like open circuits and inductors act like shorts. The above figures show the process of replacing these circuit devices with their DC equivalents. In this case, all that remains is a voltage source and a lone resistor. (An AC analysis of this circuit can be found in the AC section.)

Resistors
If a circuits contains only resistors possibly in a combination of parallel and series connections then an equivalent resistance is determined. Then Ohm's Law is used to determine the current flowing in the main circuit. A combination of voltage and current divider rules are then used to solve for other required currents and voltages.

Simplify the following: (a) (b) (c)
 * Figure 1: Simple circuits series circuits.

The circuit in Figure 1 (a) is very simple if we are given R and V, the voltage of the source, then we use Ohm's Law to solve for the current. In Figure 1 (b) if we are given R1, R2 and V then we combine the resistor into an equivalent resistors noting that are in series. Then we solve for the current as before using Ohm's Law. In Figure 1 (c) if the resistors are labeled clockwise from the top resistor R1, R2 and R3 and the voltage source has the value: V. The analysis proceeds as follows.
 * $$R_{eq}=R_1+R_2+R_3 \,$$

This is the formula for calculating the equivalent resistance of series resistor. The current is now calculated using Ohm's Law.

 * $$i=\frac {V }{R_{eq}}= \frac {V}{R_1+R_2+R_3}$$

If the voltage is required across the third resistor then we can use voltage divider rule.
 * $$V_{R3}=\frac {VR_3}{R_1+R_2+R_3}$$

Or alternatively one could use Ohm's Law together with the current just calculated.
 * $$V_{R3}=iR_3= \frac {VR_3}{R_1+R_2+R_3}$$

(a) (b)
 * Figure 2: Simple parallel circuits.

In Figure 2 (a) if the Resistor nearest the voltage source is R1 and the other resistor R2. If we need to solve for the current i. then we proceed as before. First we calculate the equivalent resistance then use Ohm's Law to solve for the current. The resistance of a parallel combination is:
 * $$R_{eq}=\frac {R_1R_2}{R_1+R_2}$$

So the current, i, flowing in the circuit is, by Ohm's Law:
 * $$i=\frac {V(R_1+R_2)}{R_1R_2}$$

If we need to solve for current through R2 then we can use current divider rule.
 * $$i_{R2}=\frac {V(R_1+R_2)(R_1)}{(R_1R_2)(R_1+R_2)}= \frac {V}{R_2}$$(1)

But it would probably have been simpler to have used the fact that V most be dropped across R2. This means that we can simply use Ohm's Law to calculate the current through R2. The equation is just equation 1. In Figure 2 (b) we do exactly the same thing except this time there are three resistors this means that the equivalent resistance will be:
 * $$ \frac {1}{R_{eq}}= \frac {1}{R_1}+\frac {1}{R_2}+\frac {1}{R_3}$$
 * $$R_{eq} =\frac {R_1R_2R_3}{R_1R_2+R_1R_3+R_2R_3}$$

Using this fact we do exactly the same thing.

(a) (b) (c)
 * Figure 3: Combined parallel and series circuits

In Figure 3 (a), if the three resistors in the outer loop of the circuit are R1, R2 and R3 and the other resistor is R4. It is simpler to see what is going on if we combine R2 and R3 into their series equivalent resistance $$R_23$$. It is clear now that the equivalent resistance is R1 in series with the parallel combination of $$R_23$$ and R4. If we want to calculate the voltage across the parallel combination of R4 and $$R_{23}$$ then we just use voltage divider.
 * $$V_{4 | | 23}=\frac {R_4 | |(R_2+R_3)V}{R_4 | |(R_2+R_3) + R_1}$$

If we want to calculate the current through R2 and R3 then we can use the voltage across $$R_4 | |(R_2+R_3)$$ and Ohm's law.
 * $$i_{23} = \frac {R_4 | |(R_2+R_3)V}{(R_4 | |(R_2+R_3) + R_1)(R_2+R_3)}$$

Or we could calculate the current in the main circuit and then use current divider rule to get the current.

In Figure 3 (b) we take the same approach simplifying parallel combinations and series combinations of resistors until we get the equivalent resistance.

In Figure 3 (c) this process doesn't work then because there are resistors connected in a delta this means that there is no way to simplify this beyond transforming them to a star or wye connection.

Note: To calculate the current draw from the source the equivalent resistance always must be calculated. But if we just need the voltage across a series resistor this may be necessary. If we want to calculate the current in parallel combination then we must use either current divider rule or calculate the voltage across the resistor and then use Ohm's law to get the current. The second method will often require less work since the current flowing from the source is required for the use of current divider rule. The use of current divider rule is much simpler in the case when the source is a current source because the value of the current is set by the current source.

The above image shows three points 1, 2, and 3 connected with resistors R1, R2, and R3 with a common point. Such a configuration is called a star network or a Y-connection.

The above image shows three points 1, 2, and 3 connected with resistor R12, R23, and R31. The configuration is called a delta network or delta connection.

We have seen that the series and parallel networks can be reduced by the use of simple equations. Now we will derive similar relations to convert a star network to delta and vice versa. Consider the points 1 and 2. The resistance between them in the star case is simply

R1 + R2

For the delta case, we have

R12 || (R31 + R23)

We have similar relations for the points 2, 3 and 3, 1. Making the substitution r1= R23 etc., we have, simplifying,

$$ R_1 = \frac{r_2r_3}{r_1 + r_2 + r_3} $$

$$ r_1 = \frac{R_1R_2 + R_2R_3 + R_3R_1}{R_1} $$

in the most general case. If all the resistances are equal, then R = r/3.

title: Electronics/DC Circuit Analysis


text:
User:Berni~enwikibooks

Meine Bücher:

 * Das Zahlkörpersieb

Siehe um mehr über mich zu erfahren.

title: User:Berni~enwikibooks


text:
Bicycles/Tire patches

Patches of rubber for repairing inner tubes. They are available in three varieties: regular, feather edged and self adhesive. All are available in a variety of sizes.

Regular
These are simply cut or stamped from a sheet of material. The side to be glued is usually slightly sticky, and protected by a plastic film which should be removed just before use. As they are the same thickness all over there will be a sudden change in stiffness of the repaired inner tube at the edge of the patch. This can cause the patch to start peeling from the inner tube if not well stuck.

Feather Edge
These are as thick as regular patches in the middle, but get thinner towards the edge. This makes it less likely that the patch will peel from the inner tube if not well stuck. They usually have a metal foil protecting the side to be glued, and a plastic film to support the thin edges while the patch is placed and pressed down.

Self Adhesive
These are patches of either of the above types, but do not need a separate glue. Simply roughen the tube, peel the protective film from the patch and stick.

title: Bicycles/Tire patches


text:
Perl Programming/Functions

A Perl function is a grouping of code that allows it to be easily used repeatedly. Functions are a key organizing component in all but the smallest of programs.

Introduction
So far we have written just a few lines of Perl at a time. Our example programs have started at the top of a file and proceeded to the bottom of the file, with a little jumping around using control-flow keywords like if, else and while. In many instances, though, it is useful to add another layer of organization on our programs.

For example, when something goes wrong in a typical program, it prints an "error message". The code to print an error message might look like

Other messages might look slightly different, like

We could pepper our code with hundreds of lines just like this, and things would work just fine…for a while. But sooner or later, we'd want to separate out error messages from "status messages" that report harmless information about our program. To do this, we could prefix all of our error messages with the word "ERROR" and all of the status messages with "STATUS". The code for a typical error messages would change to

The problem is, with hundreds of error messages, it would be a hassle to go change them all. This is where subroutines can help out.

The Wikipedia defines a subroutine, as "a sequence of instructions that perform a specific task, as part of a larger program. Subroutines can be called from different locations in a program, thus allowing programs to access the subroutine repeatedly without the subroutine's code having been written more than once."

All that gobblydeegook means we can wrap up our error message code in one place, as follows:

Whenever something goes wrong in our program, we can activate, or call, this subroutine, with whatever message we prefer:

And see messages such as

ERROR: something bad happened

If we need to change the formatting of our error message, say, to include a few exclamation points, it's simple enough to change the subroutine:

This has been an admittedly simple example, and subroutines have a few other advantages, but that's it in a nutshell. Type it in one place, fix it in one place, change it in one place.

Now for a little more detail about subroutines. Much of what follows will use the following subroutine, which, if it isn't obvious already, adds two numbers together, and returns their sum.

Name
The first line of a function begins with the keyword sub followed by the function's name. Any string of letters and numbers that is not a reserved Perl word (such as for, while, <tt>if</tt> and <tt>else</tt>) is a valid function name. Subroutines with names that describe what the subroutine does make for easier-to-read programs.

Prototype (rarely used)
The optional <tt>($$)</tt> specifies how many arguments this subroutine expects. <tt>($$)</tt> says "this function requires two scalar values". Perl prototypes are NOT what most people with experience with other languages expect them to be: instead, the prototypes alter the context of the parameters to the subroutine.

It is possible to disable a prototype by calling the function with a leading <tt>&</tt>, but this is not recommended.

Prototypes are used only seldomly, as it's much easier to use the normal method of passing parameters.

Body
The body of a subroutine does the "work", and consists of three primary sections.

Reading arguments
The pieces of information handed to a subroutine are called arguments or actual parameters. For instance, in

<tt>3</tt> and <tt>4</tt> are the arguments to the subroutine <tt>add_two_numbers</tt>.

Perl passes arguments to a subroutine in an array represented by <tt>@_</tt>. Usually it is more convenient to give meaningful names to these arguments, so the first line of a function often looks like

that puts the contents of <tt>@_</tt> into two variables named <tt>$x</tt> and <tt>$y</tt>. <tt>$x</tt> and <tt>$y</tt> are called formal parameters. The distinction between formal parameters (arguments) and actual parameters is subtle and for the most part unimportant. It is described somewhat in the wikipedia article Parameter (computer science). Be careful not to confuse the special variable <tt>$_</tt> and <tt>@_</tt>, the array of arguments passed to a function.

Some subroutines don't require any arguments, for example

will print "<tt>Hello World</tt>" to STDOUT. This subroutine doesn't need any extra information about how to do its job and accordingly doesn't need any arguments.

Most modern programming languages save programmers the trouble of explicitly breaking the argument array into variables. Unfortunately, Perl does not. Which, on the other hand, makes writing subroutines with variable number of arguments very easy.

In programming context parameter means almost the same thing as argument (see parameter for details). The two are often confused with no loss of understanding.

Important note: global and local variables
Unlike programming languages such as C or Java, all variables created or used within Perl subroutines are, by default, global variables. This means that any piece of your program outside of your subroutine may modify these variables, and that your subroutine may be, unknowingly, modifying variables that it has no business modifying. In small programs this is often convenient, but as programs get longer this often leads to complexity and is considered poor practice.

The best way to avoid this trap is to place the keyword <tt>my</tt> in front of all your variables the first time they appear. This tells Perl that you only want these variables to be available inside the nearest enclosing group of curly braces. In effect, these local variables act as a "scratch space" for use within your subroutines that disappears when the subroutine returns. The line <tt>use strict;</tt> at the top of your program will instruct Perl to force you to use <tt>my</tt> in front of your variables, to prevent you from accidentally creating global variables.

An alternative to <tt>my</tt> that you may see in some older Perl programs is the <tt>local</tt> keyword. <tt>local</tt> is somewhat similar to <tt>my</tt>, but is more complicated to deal with. It's better to stick with <tt>my</tt> in your own programs.

"Scope" describes whether a variable is local or global, and a couple of other complexities. See scope for a technical discussion.

The interesting part of a subroutine
In the very middle of the subroutine you're likely to find the more interesting "guts" of it all. In our add_two_numbers subroutine, this is the part that actually does the adding

In this middle section, you can do just about anything your heart desires, arithmetic, printing to files, or even calling other subroutines.

The <tt>return</tt> statement
Finally, some subroutines "return" some piece of information, called the "return value", using the <tt>return</tt> keyword.

For example

will set <tt>$sum</tt> to 9 (the sum of 4 and 5).

<tt>return</tt> can also be used without any return value as a shortcut to leave a subroutine before getting to a closing <tt>}</tt>

Invoking subroutines
Subroutines may be declared anywhere within a Perl program. They may be invoked like so:

If no "<tt>&</tt>" prefix is used, parentheses are required unless the subroutine has been predeclared.

Functions calling functions
On their own, functions provide a major stepping stone towards good code, but combining functions together really unleashes their power.

As you might expect, calling a function from within another function doesn't look any different from calling a function from the part of your program that is sitting outside any curly-braces.

This function adds two numbers, then multiplies them by 3. Bear with us on the uselessness of these functions. As you build your own programs to solve your unique problems, you'll see their usefulness immediately.

The line

calls our function <tt>add_two_numbers</tt> and puts the result into our <tt>$sum</tt> variable. Easy stuff, huh?

In this function, we've actually written much more code than we need. It could be pared down to something much smaller, but equally readable:

Functions calling themselves — recursion
We've seen functions calling other functions, but one neat concept in programming is when functions call themselves. This is called recursion. At first it seems like this might cause a so-called infinite loop, but it's really quite standard programming.

In math, the factorial function, multiplies a positive integer by each positive integer less than itself. For example, "5 factorial" (usually written <tt>5!</tt>) is calculated by multiplying 5 times 4 times 3 times 2 times 1. Of course, the 1 doesn't change the result. The factorial function is useful in calculating things like the number of different possible ways to seat your relatives at the dinner table.

Factorial makes a natural example for recursion, though it can be written just as easily with a <tt>while</tt> loop.

The self-referential line here is

which calls the factorial function from within the factorial function. This would go on forever, but we have a sort of stop-sign that prevents it:

This stops the sequence of calls to factorial and prevents the never-ending infinite loop.

Written in a sort of longhand

factorial(5) = 5*factorial(4) = 5*4*factorial(3) = 5*4*3*factorial(2) = 5*4*3*2*factorial(1) = 5*4*3*2*1 = 120

We've just barely touched on recursion. For some programming problems, it is a very natural solution. For others, it's a little… unnatural. Suffice it to say, it's a tool every programmer should carry in his or her belt.

Functions vs procedures vs subroutines
While reading programming literature and talking to programmers, you might run across the three terms "functions", "procedures" and "subroutines". Most of the time these are used interchangeably, but for the purists out there:

A function always returns a value, and, given the same arguments, always returns the same value. Functions are a lot like the functions you may have used in math class.

A procedure, unlike a function, may return no value at all. Unlike a function, a procedure often interacts with its external environment beyond its argument array. For instance, a procedure may read and write to files.

A subroutine refers to a sequence of instructions that may be either a function or a procedure.

The official grammar
The syntax for defining a subroutine is:

sub NAME PROTOTYPE ATTRIBUTES BLOCK

If this makes any sense to you, you probably don't need to be reading this book ;)

Perl/関数

title: Perl Programming/Functions


text:
Template:German/Levels

Level I • Level II • Level III • Level IV • Level V

title: Template:German/Levels


text:
File:Dielsalder.png

A very simple Diels-Alder Reaction

title: File:Dielsalder.png


text:
File:Dielsalder2.png

More realistic Diels-Alder reaction with a substituated dienophile

title: File:Dielsalder2.png


text:
Organic Chemistry/Introduction to reactions/Diels-Alder reaction

The Diels-Alder reaction, named after the German chemists who developed it, is a method for producing simple ring compounds.

Mechanism of a reaction between a diene and a dienophile

In the Diels-Alder reaction, a conjugated diene reacts with a dienophile. The dienophile is named for its affinity to react with the diene.

Because dienes and dienophiles are often gases, this reaction usually takes place in a sealed container at elevated pressure and temperature. The temperature required by this reaction can be reduced by the presence of electron-witdrawing groups attached to the dienophile.

In some cases, such as furan and maleic anhydride, or cyclopentadiene and acrolein, the reaction will take place at room temperature in an ethoxyethane solution.

The reaction shown above is highly unlikely due to the lack of substituents on the diene and dienophile. The dienophile will usually have a carbonyl, nitro, or other electron-withdrawing group attached. Any substituents attached to the diene or dienophile will end up in the final product.

''Notice that the product retains the same basic cyclohexene structure. The substituents simply extend from the ring.''

Alkynes can also react as dienophiles.

Diels-Alder reactions can sometimes reverse themselves through Retro-Diels-Alder reactions. For example, dicyclopentadiene can be cracked to form 1,3-cyclopentadiene by thermal dissociation. Retro reactions occur under situations where the fragments are stable by themselves.

Read more about Kurt Alder and Otto Diels in the Wikipedia.


text:
XML - Managing Data Exchange/Parsing XML files

In the earlier chapters we were taught how to create XML files in detail. This involved the development of XML documents, Style sheets and Schema and their validation. In this chapter, we will focus on different approaches for parsing XML files and when to use them.

But first, it is time to refresh what we have learned about parsing.

The Process of Parsing XML files
One goal of the XML format was to enhance raw data formats like plain text by including detailed descriptions of the meaning of the content. Now, in order to be able to read XML files, we use a parser which basically exposes the document’s content through a so-called API (application programming interface). In other words, a client application accesses the content of the XML document through an interface, instead of having to interpret the XML code on its own!

Simple Text Parsing
One way to extract data from an XML document is simple text parsing – browsing all characters in the document and check for a desired pattern:

Let’s say we are interested in the value of the house. Using straight text parsing, we would scan the file for the character sequence and call it the start pattern. Then, we would further scan the document for the end pattern (i.e. ). Finally, we declare the text string in between these two patterns to be the value of the surrounding  tag.

Why it doesn't work that way
Obviously, this approach is not suitable for extracting information from large and complex XML documents, since we would have to know exactly what the file looks like and where the information needed is located. From a more general point of view, the structure and semantics of an XML file is determined by the makeup of the document, its tags and attributes – hence, we need a device that is able to recognize and understand this structure and can point out any errors in it. Moreover, it has to provide the content of the document through an interface, so that other applications can access it without difficulty. This device is known as an XML parser.

What a parser does
Almost all programs that need to process XML documents use an XML parser to extract the information stored in the XML document in order to avoid any of the difficulties that occur when reading and interpreting raw XML data. The parser usually is a class library (e.g. a set of Java class files) that reads a given document and checks if it is well-formed according to the W3C specification. Then, any client software can use methods of the interface provided by the parser API to access the information the parser retrieved from the XML file.

All in all, the parser shields the user from dealing with the complex details of XML like assembling information distributed over several XML files, checking for well-formedness constraints, and so on.

Parsing: an Example
To illustrate more clearly what parsing an XML file really means, the following example was created which contains information about some cities. It also keeps track of who is on vacation and demonstrates the parsing process with the currently most common parsing methods.

Example: cities.xml
Based on the information stored in this XML document, we can easily check who is on vacation and where. The parser will read the file using one of the various techniques presented later in this chapter.

This process is very complicated and prone to errors of all kinds. Luckily, we will never have to write code for it, because there are plenty of free, fully-functional parsers on the Web. All we do is download a parser class library and access the XML document through the interface provided by the parser software. With more recent builds of Java, most parsers do not even have to be downloaded. In other words, we use the functions or methods included in the class library for extracting the information.

Basically, a parser reads the XML document and tries to recognize the structure of the file itself while checking for errors. It simply checks for start/end tags, attributes, namespaces, prefixes, and so on. Then, the client software can access the information derived from this structure using methods provided by the parser software (i.e. the interface).

The best way to learn about the functionality of a parser is to actually use them; therefore, the next section demonstrates the different methods of parsing.

Overview
There are two “traditional” approaches that dominate the market right now, an event-based push-model as represented by SAX (Simple API for XML) and a tree-based model using the DOM (document object model) approach.

However, there is a movement towards newer approaches and techniques that try to overcome the flaws inherent in these traditional models – an event-based pull-model and a “cursor model”, such as VTD-XML, which allows us to browse the XML document just like in the tree-based approach, but simpler and easier to use.

Description
The push model, typically the exemplified by SAX (www.saxproject.org) is the “gold standard” of XML parsing, since it is probably the most complete and accurate method so far. The SAX classes provide an interface between the input streams from which XML documents are read and the client software which receives the data made available by the parser. The parser browses through the whole document and fires events every time it recognizes an XML construct (e.g. it recognizes a start tag and fires an event – the client software is notified and can use this information… or not).

Evaluation
The advantage of such a model is that we don’t need to store the whole XML document in memory, since we are only reading one piece of information at a time. If you recall that the XML structure is a set of nodes of various types (like an element node) – parsing the document with a SAX parser means going through each node one at a time. This makes it possible to read even very large XML documents in a memory-efficient way. However, the fact that the parser only provides information about the node currently read also implies that the programmer of the client software is in charge of saving certain information in a separate data structure (e.g. the parents or children of the currently processed node). Moreover, the SAX approach is pretty much read-only, since it is hard to modify the XML structure when we do not have some sort of global view.

In fact, the parser is in control of what is read when. The user can only wait until a certain event has occurred and then use the information stored in the currently processed node.

Example: TGSAXParser.java
As mentioned before, the best way to fully understand the concept of the parsing process is to actually use it. In the following code sample, the information about the name and country of the cities that people are vacationing in will be displayed. The SAX API that is part of the Xerces parser package was used for the implementation ((Xerces 2 Homepage):

The : As mentioned before, SAX is completely event-driven. Therefore, we need a handler that “listens” to the input stream coming from the input file (cities.xml in this case).

The SAX API provides interface classes, which we have to extend with our own code to read our own specific XML document. In order to include our code in the SAX API, we just have to extend the DefaultHandler interface with our own class and set the content handler to our custom handler class (which consists of three methods: startElement, endElement and characters)

The  and   methods: These methods are invoked whenever the SAX parser finds a start or end tag respectively. The SAX API provides blank stubs for both methods and we have to fill them with code of our own.

In this case, we want our program to do something whenever the  attribute is set, so we set a Boolean variable to true whenever we find such an element and process the node by printing out the character sequence in between the start and end tag. The  method is automatically called whenever a   and   event was triggered, but prints out the character string only if the   attribute is set.

Description
The other popular approach is the tree-based model as represented by the DOM (document object model, see W3C Recommendation). This method actually works similarly to a SAX parser, since it reads the XML document from an input stream by browsing through the file and recognizing XML structures.

This time, instead of returning the content of the document in a series of small fragments, the DOM method maps the XML hierarchy to a DOM tree object that contains everything from the original XML document. Everything from elements, comments, textual information or processing instructions is stored in the tree object as nodes, starting with the document itself as the root node.

Now that all the information we need is stored in memory, we access the data by using methods provided by the parser software to read or modify objects within the tree. This facilitates random access to the content of the XML document and provides the possibility to modify the data it contains or even create new XML files by transforming a DOM back to an XML document.

Evaluation
However, the major downside of this approach is that it requires much more memory and is therefore not suitable for situations where large XML files are used. More importantly, it is somewhat more complex than the simplistic SAX method even for small and simple problems.

Example: MyDOMParser.java
In the following code sample, a list of cities with people on vacation is again created but this time with the tree-based approach:

In order to work with the DOM object, we have to create a variable holding it (of type  ).

Then, we create a list of nodes holding all elements with the tag name. The parser finds these nodes by browsing through the DOM tree. Then, we just go through each one of the city-elements and check if the vacation attribute is set and display all the information about the vacationer if so.

Xerces provides a helpful method called that lets us directly access the text node of an element node, avoiding all difficulties emerging from unneeded white space and the like.

Summary
Choosing an API at the beginning of your XML project is a very important decision. Once you decide which one to use, it is easy to try different vendors without having much trouble, but switching to a different API will be a very time-consuming and costly process, since you will have to redesign your whole program code.

The SAX API is a widely accepted and well-working parser that is easy to implement and works especially well with streaming content (e.g. an online XML source). Because it is a read-only API, you would not be able to modify the underlying XML data source. Since it only reads one node at a time, it is very memory-efficient and fast. However, this implies that your application expects the information to be close together and ordered.

If you want to randomly access the entire document at any point of time, then the DOM approach might be a better choice for you. The DOM API is more complex and harder to implement, but gives you full control over the whole document and lets you modify the data, also. However, it reads the whole XML document into memory, so the DOM API is not suitable for projects with very large XML files.

Recommended optional exercise
''Use the code sample for the SAX and DOM parser from this chapter and play around with it. You probably want to print out different nodes or add more constraints. This absolutely optional, but will give you an idea of the main differences between SAX and DOM.''

Now for the exercise

 * Create a SAX parser to parse the file movies.xml. The output simply needs to come from your IDE, it does not need to be sent onto a webpage.

TO HELP YOU download this, it provides a structure of the problem so that you can more easily run the app in NetBeans 5.0.

If you’re interested in using Xerces – just download the following file:

http://www.apache.org/dist/xml/xerces-j/Xerces-J-bin.2.8.0.zip

If the above link is dead. Go to http://www.apache.org/dist/xml/xerces-j/ and download the latest zip binary file. It should be in the format of "Xerces-J-bin.#.#.#.zip"

Then put the content into the \lib\ext subfolder of your NetBeans directory and start up NetBeans IDE. Now, the Xerces package is successfully installed on your machine.

Useful Links

 * 1) http://www.cafeconleche.org
 * 2) http://www.xml.com
 * 3) http://www.xmlpull.org
 * 4) http://workshop.bea.com/xmlbeans/reference/com/bea/xml/XmlCursor.html
 * 5) http://workshop.bea.com/xmlbeans/reference/com/bea/xml/XmlCursor.html

Programmation XML/Parsing