OpenLLM-France/wikimedia huggingface dataset:
# Usability for Nerds/The design of a button should reflect its importance

The buttons on a control panel or keyboard should be arranged so that the buttons that are used most often are big and have the most prominent positions, while buttons that are seldom used may be smaller and put away in a corner. Buttons that are used for basic setup and configuration may be put away under a lid, so that people know that these are not for everyday use.
On a photocopier, for example, there is just one button that you use all the time, and that is the big green button you press to make a copy. The picture below shows a bad design of a photocopier control panel. The green copy button is no bigger than the other buttons. For this reason, many people press the gray ON/OFF button to the right instead.
There are certain buttons that cause big consequences when you press them. For example the main power switch at a hospital. Such a button should of course not look like just another switch.
This principle is illustrated by the story of Radio X. Radio X is a little non-profit radio station run by uneducated volunteers. New volunteers need to spend time in the sound studio learning how to use all the equipment. Typically, they will play music and say something in the microphones and then mix it together on the mixer. They are told that there is only one button they are not allowed to touch - the one that turns on broadcasting. Nevertheless, it often happened that this button was turned on by accident. The result was that thousands of people could hear the silly things they were saying in the microphones and that another radio station using the same frequency was unable to send.
The solution to this problem was to replace the "on air" switch by a lock with a key. A lock looks very different from all the other buttons and dials. A lock does not say: "This is just another button that you can press to see what it does". It says: "This is restricted access. Turning this key has important consequences". The key was always sitting in the lock, so nothing prevented deliberate abuse. But that never happened again.
What do these different switches signify?
← Design should reflect the user's logic, not the constructor's logic · Provide alternative ways out of a situation →
# Usability for Nerds/The user should be in control

Imagine this situation:
A man sits in front of a computer screen. A message on the screen says: Enter name. The user writes his name.
Nothing happens. The user finds out that he has to press the Enter key.
Computer says: Enter address.
The user enters his address.
After a few more questions the computer says: Enter fax number.
The user has no fax, so he just presses the Enter key.
The computer repeats: Enter fax number.
The user writes 0 and presses the Enter key.
The computer says: Illegal entry. Enter fax number.
The user looks up the fax number of his wife's workplace and enters the number.
The computer accepts the fax number and says: Enter account number.
The user has no account number, so he writes 123456789.
The computer says: Illegal entry. Enter account number.
By now the user has realized that he has got into something wrong. He writes: Stop.
The computer says: Illegal entry. Enter account number.
The user writes: Help.
The computer says: Illegal entry. Enter account number.
The user presses the Escape key several times, but nothing happens.
The user turns off the computer and loses his data.
What is wrong here? The problem is that the computer issues commands and expects the user to obey. The user would certainly prefer that he can make commands and the computer obey. The computer should be a helpful servant, not a cruel master. How is this possible? The picture below shows the answer:
The user clicks a menu that says new user. Then he gets a dialog box where he can write his name etc. He can see at once which information is needed, so there is no need to write a name and address if he doesn't have an account number. He can enter the details in any order he wants. He can press the Cancel button if he regrets. He can press the Help button or the question mark button if he wants to know what Account number means.
In the former situation the user gets stressed and frustrated because the computer is controlling him and taking away his freedom to do what he wants. In the latter situation the user is happy and relaxed because he is controlling the computer and can make it do what he wants.
← Feedback to user · Self-explaining interfaces →
# Visual Basic/Simple Graphics

This chapter is a simple introduction to drawing simple graphics in Visual Basic Classic. It is possible to do very sophisticated graphics programming in VB but here we will concentrate of the basics.
There are two ways of creating simple two dimensional graphics in VB:
If you know in advance exactly what to draw, then it might be simpler to use the second method, as you can then see exactly what you will get as you drag and drop shapes to the form. However if the picture is to be generated based on, say, some statistics, you might be better off using the drawing methods of a Form or PictureBox.

## Shape and Line controls

There are two built-in controls in Visual Basic that can be used to create simple two-dimensional drawings:
* Shape
* Line
Here is a simple example showing some of the shapes that can be created simply by dropping Shape controls on a Form:
Note that you can modify the properties of Shape and Line controls at run time just as you can any other control. You can also create them at run time, either by using Control Arrays or by using the CreateObject function.
| Previous: User Interfaces | Contents | Next: Files |
# Visual Basic/Strings

Visual Basic has a traditional set of built in string operations. Unlike many languages Visual Basic strings are always Unicode so they can hold any character. They are also always dynamically allocated and are of almost unlimited length (theoretically up to about 2$^{31}$ characters, about 2000 million).
Note that Unicode uses more than one byte to represent each character. As far as VB is concerned Unicode characters are two bytes which gives 2$^{16}$ or 65536 possible values. This is enough even for Chinese, Japanese and Korean character sets (CJK). In fact Unicode defines 17 planes each of which has room for 2$^{16}$ code points but VB (and Windows) uses only the Basic Multilingual Plane (BMP).
See What Are VB Strings? for a concise explanation of the internal workings of Visual Basic Classic strings.

## Built In String Functions

Visual Basic provides a reasonable set of traditional functions for manipulating and searching strings. These functions are usually all that is needed for most programs that are not primarily concerned with text processing.

## Regular Expressions

A regular expression is a character string in which some characters have special meanings. Such a string can be used to search for substrings in another string in much more sophisticated ways than the built in InStr function.
For example this expression:
will match either 'dog' or 'cat'.
Visual Basic has no built in regular expression functions, but these are available in the VBScript regular expression library. If your program does a lot of text processing regular expressions are definitely worth learning even though they may seem intimidating at the start. In practice most programmers find that the more arcane expressions are rarely used and the same idioms are recycled over and over so there is really not as much to learn as it at first appears.
| Previous: Loops | Contents | Next: Built In String Functions |
# Visual Basic/Regular Expression Tester
## Introduction

This is a very small program that demonstrates that useful programs do not need to be large. While toying with the idea of automated download and build of source included in Wikibooks I needed to test some Regular Expressions. I searched the Web for ready made tools but found nothing that really fitted what I wanted to do. Eric Gunnerson's C# tool is very good but relies on the .NET libraries which seems an unnecessarily large overhead for such a small program. So I built my own in about fifteen minutes. Here it is, it has the bare minimum of error checking, the controls are not neatly arranged and the form is not resizeable, or rather it is but the controls don't. It has a lot of limitations and definitely needs improvement, see Exercises.

## frmRegExpTester.frm

This form is the only module in the program. All the difficult work is done by the VBScript Regular Expression Library. See Regular Expressions.
The control layout on the form is just what first came to mind. It definitely needs improvement in several areas: resizeability, tab order, etc.
There is a control for each of the properties and methods of the RegExp class so you can exercise all of the capabilities of it. each of the controls reacts to the Changed Click events by setting properties as appropriate and calling both the Test and Execute methods.
The RegExp instance is available to all the code in this module although this is not strictly necessary because we could create a new one each time.
Each of the Boolean properties is represented by a CheckBox control. The click event for each one simply sets the appropriate property value and calls the Execute method via the xExecute local subroutine.
When the form is created the Initialize event handler is called. This creates the RegExp instance and sets the properties to correspond to the values of the controls.
When the user changes either the regular expression or the source text the output is updated by calling xExecute
This is the heart of the program. All it does is to call the Execute method and then construct a string to represent the result. If the pattern is invalid then the Execute method will raise an error. this is trapped and the error description used instead of the result. The result object is declared as Object because the return type can be either Match or MatchCollection depending on whether there is only one match or more than one. The results are shown in the txtExecuteResult and txtTestresult text boxes.
The whole purpose of the program is to show the user what the result of matching the regular expression to a text string will be. To do this we simply create a string that represents a Match or MatchCollection object.

## regexptester.vbp

The project file is very simple. No unusual references except the regular expression library.
Exercises:
* Run the program and see if you can cause it to crash,
* Tidy up the user interface, add accelerator keys to aid navigation, fix the tab order,
* Think of a feature that might be worth adding and add it.
| Previous: Case Studies | Contents | Next: JArithmetic |
# We ♥ Katamari/Presents

Royal Presents for The Prince in We ♥ Katamari.

## Hats

| Present | Stage | Location |
| Headphones | As Large/Fast As Possible 1 | On the last of the paper airplanes circling the stage. |
| Mushroom | Camping stage | Near a bridge next to a group of people studying kayaking. |
| Mt. Fuji | Stage 5 | Inside of Mt. Fuji. |
| Crown | Old Man / Stage 3 | Near the hurdles on the school yard. |
| Little Buddy | As Large As Possible 4 | On top of a plane flying around the ranch. |
| Antennae | Clean up stage | On the windowsill behind where you start. |
| Flower | Flower stage | Bump the tree with the elf on a swing, the present should fall down. |
| Giraffe | Zoo stage | On a totem pole near the water area. |
| Ear Ribbons | School stage | In the bathroom stall closest to the door. The stall door is locked so you have to be big enough to pick up walls. (about 3m) |
| Wig | Save the Pandas stage | In the market, near the pool, behind a stack of boxes under a canopy. |

## Face

| Present | Stage | location |
| Grandfather of All Cosmos mask | Snowman stage | On Santa's sleigh. You need to be big enough, yet not too big. |
| Mask | Saturn / 50m | Under a red bridge near New York. There is an arrow of anchors floating in the water pointing to it. |
| Glasses | Firefly stage | On the top of the RV parked near the water. |
| Long nose | Gingerbread house | On the witch's broom. |
| Moustache | Cow-bear stage | In the car wash at the pit area of the racetrack (sliding in and out) |
| Trumpet | Cloud stage | Near Fujio (cousin). You need to be pretty big. |

## Body

| Present | Stage | location |
| Scarf | Saturn Small | In a dog food bowl outside the door on the porch. |
| Guitar | Saturn Medium | On top of a tall locker in the corner of the far classroom. |
| Horsey | Race stage | On the big docked cruise-liner near the finish line. |
| Cool Belt | Sumo stage | Thrown at the hippopotamus in the swimming pool near the ring. |
| Peacock Feathers | Baby Stage | In the safari area balanced on the nose of a bear who is being held by a guy standing on a ball. |
| Bikini | Underwater stage | Floating above the water on the back of a duck. Get to 80cm, get on the boat, and grab it. |
| Pouchette | Origami stage | On the back of a big crane walking in the hallway. |
# We ♥ Katamari/Fruit
## Page 1

| Fruit | Description | Size to roll up |
| Cherries | A fruit that comes as twins. Availble in larger sizes, too. | 8cm0mm |
| Monster Cherries | If you can knot the stem with your tongue, it means you're a verry good kisser. | 12cm0mm |
| Strawberry | A bite-sized, bright red fruit. The bumpy things on the surface are seeds, but you don't need to pick them off. | 7cm2mm |
| Giant Strawberry | You'd better open wide if you want to eat this. Goes well with milk. | 10cm8mm |
| Strawberry Pack | A package of carefully lined up strawberries. They're all blushing red because their butts are pointing upward. | 28cm4mm |
| Mandarin Piece | The part that comes out after peeling the skin off. Removing the white part doesn't change the taste any. | 6cm5mm |
| Mandarin | Similar to an orange, but much easier to peel. Not very tasty at all with the skin on... | 14cm1mm |
| Persimmon | A big orange fruit that tastes really bad unless it is fully ripe. | 24cm2mm |

## Page 2

| Fruit | Description | Size to roll up |
| Grapes | A bunch of small, purple fruits. Tart and tangy, but a lot of work to eat. | 41cm2mm |
| Muscat | A close relative of the grape. No matter how hard it tries, it will never turn purple. | 41cm2mm |
| Banana | A fruit that gives its eater tremendous power. You don't need to be a monkey to eat this. | 21cm4mm |
| Banana Bunch | A big bundle of energy fuirt. People usually don't eat these all at once. | 40cm6mm |
| Pear | A crunchy, tasty fruit that's bountiful in autumn. Tons of juice, too. | 24cm6mm |
| Big Pear | A pear that is a delicious fruit. A bear is a malicious brute. | 36cm9mm |
| Apple | This fruit teaches you about gravity and is good for your gums. | 15cm8mm |
| Monster Apple | Some people carve this in the shape of a rabbit. But it won't taste like a rabbit. | 36cm9mm |

## Page 3

| Fruit | Description | Size to roll up |
| Canned Peach | So sweet and luscious, they had to seal it away in a can for its own safety. | 34cm3mm |
| Peach | A fruit that looks just like a baby's butt. | 25cm1mm |
| Big Peach | A fruit that leaks juice when you bite it. The fuzz tickles your nose, too. | 1m0cm5mm |
| Melon | One kind is called a Prince melon, but there aren't any King and Queen melons. | 32cm9mm |
| Monster Melon | A sweet, juicy fruit. Its skin looks like a maze, but there's no start or finish, so it's hard to solve. | 60cm7mm |
| Apple Basket | Eating all these apples will keep the doctor away for ages. | 94cm6mm |
| Peach Basket | A basket full of butt-shaped fruit. | 94cm1mm |
| Orange Basket | A basket full of sour orange fruit. Peel it, and your fingers get all sticky. | 93cm8mm |

## Page 4

| Fruit | Description | Size to roll up |
| Pineapple | Looks sort of like a bomb, but the only explosive thing here is the sweet, tart, tropical taste. | 65cm0mm |
| Gigantic Pineapple | A huge and sweet tropical fruit. You probably couldn't eat it by yourself. | 2m37cm2mm |
# We ♥ Katamari/Sewing

Sewing items found in We ♥ Katamari.

## Page 1

| Sewing item | Description | Size to roll up |
| Thread (Red & White) | A bunch of string wrapped around a piece of paper. Whoever wroapped this must be very disciplined. | 8cm4mm |
| Thread (Navy) | String is wrapped around and around this thing. That slit the string goes into is a superb idea . | 8cm4mm |
| Thread (Green) | A string wrapped around a cylindrical object. Drop this on the floor, and the string will unravel. | 10cm7mm |
| Thread (White) | The hole in the middle makes this very handy. To put it bluntly, it's something like a roll of toiler paper. | 10cm7mm |
| Red Dress Pin | A needle with a little ball on its head. Even if you remove the ball, there won't be a hole you can run a thread through. | 2cm7mm |
| Green Dress Pin | A needlie you put through pieces of cloth to keep them from sliding apart. you can't actually wear it as a dress. | 2cm7mm |
| Dress Pin | A tool used to hold cloth in place while sewing. | 2cm7mm |
| Pin Cushion | A cushion with lots of pins stuck in it. Apparently not a piece of artwork. | 13cm8mm |

## Page 2

| Sewing item | Description | Size to roll up |
| Sewing Box | This is full of tools for cutting and poking cloth. A torture kit, as far as colth's concerned. | 86cm4mm |
# We ♥ Katamari/Powerful
## Page 1

| Item | Description | Size to roll up |
| Barbell | A pretty heavy bar. If you start trembling while lifting this, you're probably close to your limit. | 1m68cm0mm |
| Hard-working Trainee | He's building up his legs and hips with so-called bunny hops. His sandals are made out of aluminum. | 1m50cm3mm |
| Trainee | Apparently, he isn't practicing poking people with his ducktail. | 1m55cm2mm |
| Beetle Fight | Tow beetles fight it out. This is war! | 20cm9mm |
| Wrestling Match | Two girls fighting in swimsuits. Physical size doesnt' necessarily mean victory. | 3m0cm3mm |
| Sumo Bout | What a throw! They must have planned that beforehand. | 4m67cm5mm |
| Judo Contest | They're training for the gold medal, but this would be an illegal move in sanctioned events. | 4m50cm3mm |
| Killer Move | An epic battle that continues without end. There's not even a lunch break. | 2m85cm0mm |

## Page 2

| Item | Description | Size to roll up |
| Axe | Used primarily by barbarians and people wearing hockey masks. | 45cm2mm |
| Dumbbell | A well-used item that helps humans build their bodies. It's very heavy, so dropping it on your foot would be a tragedy. | 27cm7mm |
| Pickaxe | That sharp, pointy end is just itching to poke some holes in things. | 72cm6mm |
| Lawn Roller | An exercise device that works your hips and legs while leveling off the ground. | 2m24cm7mm |
| Elephant | Sometimes blows water out of its long trunk. Don't worry; it doesn't have the sniffles or anything. | 9m13cm4mm |
| Large Elephant | Her trunk is big enough, but look at those ears! We bet she knows all the local gossip. | 14m31cm5mm |
| Indian Elephant (RARE) | A large elephant born in India. He wishes he had bigger ears, like his African cousins. | 30m10cm8mm |
| Wrestling Ring | Normally used for fighting, but some people like to shout into microphones here instead. | 9m87cm3mm |

## Page 3

| Item | Description | Size to roll up |
| Sumo Ring | Sumo wrestlers fight in this ring. People throw salt in here before the match, so it probably tastes really salty. | 10m43cm5mm |
| Crane | A powerful machine that can lift just about anything. Unfortunately it can't compete in the Olympics. | 22m9cm9mm |
| Crane (L) | It may be huge and powerful but it's useless without the track on the bottom. | 111m35cm0mm |
# We ♥ Katamari/Reading
## Page 1

| Reading material | Description | Size to roll up |
| Weekly Magazine | A book filled with stories. Sometimes they're true, and sometimes they're not. | 30cm0mm |
| Diary | A book in which you write what happens to you that day. Usually lasts about 3 days. | 19cm4mm |
| Math Homework | The drills in this book couldn't poke a hole in a piece of paper. | 16cm2mm |
| Kanji Workbook | A study aid for difficult Chinese characters. Each one can have several pronunciations. What a headache! | 16cm2mm |
| Math Textbook | A book with lots of numbers and symbols. It doesn't appear to be very interesting. | 25cm0mm |
| Japanese Text Book | A book full of Japanese kanji. How anyone can remember and read them all is a mystery. | 25cm0mm |
| English Textbook | This is another of the languages that exists on Earth. It seems to be fairly popular. | 24cm4mm |
| History Textbook | Apparently drawing doodles on the photographs for comedic effect is very popular these days. | 29cm6mm |

## Page 2

| Reading material | Description | Size to roll up |
| Dictionary (1) | Half of this book is written in English. The other half is some kind of scribbled pictures. | 23cm7mm |
| Dictionary (2) | A book with word meanings. You're in trouble once you start looking up the meaning of word meanings. | 27cm0mm |
| Fairy Tale Book | It seems like all sorts of amazing things happened long, long ago. | 25cm0mm |
| School Yearbook | Most people look at these and wonder why they had such poor fashion sense "back then." | 25cm0mm |
| Paperback | Recommended whether you want to stay up or fall asleep. Imagination required. | 13cm9mm |
| Comic | Sometimes comes with freebies not found in grown-up magazines. Not just for children! | 28cm7mm |
| Magazine | Comes with freebies that make children happy. | 29cm3mm |
| Fashion Magazine | You cannot be popular unless you read this magazine. | 34cm2mm |

## Page 3

| Reading material | Description | Size to roll up |
| Animal Book | A book with lots of pictures of animals. Looks like they forgot to put in humans. | 35cm8mm |
| Plant Book | A book with pictures of glass and flowers and things. It only covers Earth plants. | 35cm8mm |
| Encyclopedia | A well-versed, knowledgeable book.... as far as birds are concerned, anyway. | 35cm8mm |
| Telephone Book | A thick book packed with numbers. Apparently used to talk to strangers. | 50cm6mm |
| Home Doctor Book | Anyone can be a doctor with this book. But if you really get sick, you should probably go to a hospital. | 56cm8mm |
| Magazine Rack | Storekeepers get angry if you read the magazines here without buying anything. | 1m71cm6mm |
# XQuery/Topological Sort
## Motivation

You have a Directed Acyclic Graph (DAG) to track things such as a dependency graph. You want to sort in input DAG of nodes so that in the output reflects the dependency structure.
The Topological Sort of a Directed Acyclic Graph puts nodes in a sequence such that every node references only preceding nodes.
This ordering is needed for example in scheduling processes in a Pipeline.
For example, given a DAG defined as
the topological order would be:
The definition of topological order can be simply expressed in XQuery:
A recursive algorithm is also straightforward:
which is invoked as

### Explanation

$ordered is initially the original sequence, $ordered is empty. At each iteration, the set of nodes which are dependent only on the ordered nodes are calculated and these are removed from the unordered nodes and added to the ordered nodes.