text:
Windows Programming/Compiled HTML Help

In most programs, the menu will have a popup item called "Help". In the help menu, there is frequently an option for "Contents" or "Index" or "Topics". When you click on these options, it brings up a help box.

These help boxes are known as "Compiled HTML Help Modules", or .chm files. These help files can be compiled from HTML source code using the Microsoft HTML Help Workshop, available as a free download from Microsoft.

Making HTML Help Modules
HTML help modules can be compiled from source files containing a mixture of HTML, DHTML, CSS and JavaScript. This is the same exact HTML that is used in writing web pages, so people with web experience will have a leg up creating HTML help modules. HTML, CSS and JavaScript are languages that are very well suited for graphical applications, but the functionality is far less than C or VB. The Help Workshop contains a number of different options, as to whether you want to include an index window, if you want to allow searching and indexing, if you want to have a Table of Contents, et cetera. A default page may be chosen to be displayed when the Help Module is first loaded. Pages in a help module may use hyper links to link to other pages in the module, other files on the computer, or even resources from the internet.

HTML Help API
The HTML Help Workshop comes with a header file ("htmlhelp.h") and a library file ("htmlhelp.lib") that must be utilized in your project to be able to call HTML help modules from your program. Windows.h must be included before the Htmlhelp.h file, or the compiler will spew out errors. Htmlhelp.h defines a single function, HtmlHelp that can be called from inside your program:

HWND WINAPI HtmlHelp(HWND hwndCaller, LPCTSTR pszFile, UINT uCommand, WORD_PTR dwData); This function returns a handle to the html help window, and your program can interact with this window at a relatively high level, if you want it to. The first parameter is the handle to the calling (parent) window. If you set this parameter, the help window will be a child of your window, and can communicate with it. If you set this to NULL, the help window will essentially be autonomous. The "pszFile" parameter is the filename of the target help module. The "uCommand" may contain a number of different commands, some of which are very complicated and involved. The simplest (and most common) is the HH_DISPLAY_TOPIC command, which displays help like normal, and allows the user to view and interact with the help module. The "dwData" may optionally contain additional data, depending on the command used.

If we want to open a help module, located at c:/help/myhelp.chm, we can use the following command:

hwndHelp = HtmlHelp(hwndParent,                     "C:\help\myhelp.chm",                      HH_DISPLAY_TOPIC,                      NULL);

Now, let's say that we want to open a specific page inside our help module. Let's say that our module contains a page called "example.htm". We can open the help directly to that page, by changing the destination string a little bit:

hwndHelp = HtmlHelp(hwndParent,                     "C:\help\myhelp.chm::example.htm",                      HH_DISPLAY_TOPIC,                      NULL);

And further more, we can force the page to be displayed in a particular window of our help viewer, if we have created more then one window for it. Let's say we have created a window called "SideWin" in our html help module. We can load our page (example.htm) into SideWin using the following syntax:

hwndHelp = HtmlHelp(hwndParent,                     "C:\help\myhelp.chm||example.chm>SideWin",                      HH_DISPLAY_TOPIC,                      NULL);

For more advanced options, and a discussion of some of the other commands, you should check out the related material at MSDN.

Creating an HTML Help Module
The HTML help workshop has 5 buttons across the top, In order, from left to right, they are:

 * New: create a new HTML file for editing
 * Open: open an existing HTML file for editing
 * Compile: Compile the current project into a help module
 * View: view the current help project
 * Help: Opens a help viewer window

If you click on the "New" button (or alternately select "File>New" from the menu bar), you will be prompted to select what type of new thing you want to create. To start, you should create a new project.

Selecting to create a new project will open up a wizard, that will walk you through the steps of creating a new project.

HTML Help Files
There are 3 different file types that may be included in an HTML Help project: HTML source files (.HTM) Table of Contents files (.HHC) and Index Files (.HHK). Once you have created a new project, you may edit and add all of these types of files to your project. Each HTML help module may only have one .HHC and one .HHK file.

The Project Sidebar
When you start a new project, and complete the wizard, you will see a sidebar, on the left-hand-side of the help workshop window, that will allow you to edit the project options, the table of contents, and the index.

Decompiling
On Windows, a CHM file can be extracted to plain HTML with the command: hh.exe -decompile extracted filename.chm This will decompress all files embedded in  to folder.

You can also use HTML Help Workshop to decompile CHM files. File -> Decompile...

7-Zip will open .chm files as archives allowing access to all content.

On Windows, select the topmost Topic, right-click and select Print. On the popup dialog, select "Print this heading and all subtopics.", click OK. Before selecting a printer, look in %HOMEPATH%\Local Settings\Temp for a file named ~hh*.htm. This is the concatenated HTML. The image reference will refer to the .chm file at the time of the print.

On Linux systems which use apt as a packaging tool, a CHM file is extracted to plain HTML with extract_chmLib (first command is for a Debian based OS): $ sudo apt-get install libchm-bin $ extract_chmLib tero.chm tero/

title: Windows Programming/Compiled HTML Help


text:
File:Htmlhelp.JPG

Summary
This is a screenshot of the HTML Help window in Microsoft Internet Explorer 6.0. I took and cropped this screenshot myself in mspaint. I intend to use this image to illustrate the HTML Help functionality of MS Windows.

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

title: File:Htmlhelp.JPG


text:
Managerial Economics/Budgeting Simple

Assumptions
A simple example of budgeting requires a few assumptions:

 * 1) There is only one asset to allocate: income.
 * 2) There are two items on which income can be spent: w(a)ter and (b)read
 * 3) water and bread are infinitely divisible.
 * 4) The utility function is completely specified.
 * 5) The prices of water and bread are known.

Definitions
The price of water is represented as $$P_a$$ and the price of bread as $$P_b$$.

The quantity of water acquired by the individual is represented as $$Q_a$$, and of bread as $$Q_b$$

The total income of the individual is given by $$M$$.

Budget Line
If the individual will spend all of her income (budget constraint) on either one item or the other, we can say that $$M = P_aQ_a + P_bQ_b$$ If we were to plot this line on a graph that has $$Q_a$$ as the vertical axis and $$Q_b$$ as the horizontal axis, the line traced would be the budget line of the individual.

The budget line is a set of points where the combination of water and bread purchased exhausts the individual's income.

The place where the budget line crosses the horizontal axis represents a combination including no water; all income would be spent on bread. Therefore, our formula could be rearranged to read $$Q_b = \frac{M}{Pb}$$ And if the individual were instead to spend all of her income on water we would have $$Q_a = \frac{M}{Pa}$$

Using this information we can derive the equation for the slope of the budget line, which gives us $$M = P_aQ_a  + P_bQ_b$$ And ... $$Q_a = \frac{M}{P_a} - \frac{P_b}{P_s}Q_b$$ And therefore the slope is $$-\frac{P_b}{P_a}$$

Utility
To know which combination of water and bread a person will choose, it is useful to refer to utility, which is the economists' term for satisfaction. Given the individual's tastes and desires, she will feel more or less satisfied about a particular experience. A generic utility function is described mathematically as follows $$U = f(X_1,D X_2,..., X_n)$$ meanint that an individual's utility is a function of the items $$X_1, X_2,...$$ she has available.

In this case, the utility function would be described as $$U = f(Q_a, Q_b)$$

Utility is measured in utils, which are a made-up measure with no use beyond that of making comparisons.

Convergence of Utility and the Budget Line
Every combination of water and bread on the individual's budget line will afford her a certain amount of utility. Since all individuals are assumed to be maximizing their utility (or satisfaction), it is easy to see that an individual would search for the combination that gives the most satisfaction. Such a point on the budget line is called a solution to the economic problem.

An individual's solution is not necessarily a state of 'bliss as an individual may have a lot of unsatisfied desires; what a solution means is that an individual has done the best that she can do under the constraints she lives in. In economic terms, no one ever achieves a state of bliss in this life.

Indifference Maps
If we were to calculate the utility generated by every possible combination of water and bread and plotted it on a graph having $$Q_a$$ in the Y-axis and $$Q_b$$ in the X-axis, we would trace an individual's indifference map.

If we then took all the combinations that yielded the same utility, for example 50 utils, we would notice that they form a rather smooth curve called an indifference curve. In other words, since an individual receives the same utility from every combination in the curve, she is indifferent as whether she is consuming one combination or another.

All the indifference curves of an indifference map trace a sort of topographical map where the peaks are bliss points.

Diminishing marginal utility
The shape of the indifference curves is given because the utility function obeys the law of diminishing marginal utility.

In the formula $$U=f(Q_a,Q_b)$$, U is the total utility of the individual for a given combination of $$a$$ and $$b$$. Suppose now that we plot a point X that represents 8 units of water and 6 units of bread; furthermore, suppose that such a combination gives the individual 50 utils of satisfaction. If by acquiring one more unit of bread we discover the individual now enjoys 55 utils, we say that the marginal utility of the 9th unit of bread is five utils because a change from 8 units to 9 resuted in an increase of 5 utils.

Note that we didn't change the quantity of water in the previous example. This is essential because otherwise we cannot tell what caused the change in utility. When analyzing economics, we often hold all things equal except one, a situation termed ceteris paribus.

TODO: finish definition of diminishing marginal utility tie it back to the shape of the indifference curves, define the equimarginal principle

title: Managerial Economics/Budgeting Simple


text:
Suzuki UC125

Suzuki UC125, also known as the SJ125T Epicuro repair manual. This manual will be slowly added to by myself and others when we need to make our own repairs.

The Suzuki UC125 comes with a single-cylinder, 4-stroke engine with 4 valves. It has a maximum power output of 15 hp and a maximum torque output of 10.9 Nm. It has a dry weight of 123 kg and its seat height is 760 mm. The Suzuki UC125 has a wheelbase of 1,350 mm.

The Suzuki SJ125T is a 4 stroke, single cylinder, Single OHC 124cc scooter with a maximum power output of 11 kilowatts and a top speed of just over 100 km/h.

Table of contents

 * 1) /Specifications/
 * 2) Part numbers
 * 3) /Battery/
 * 4) /Carburetor/
 * 5) /Common Faults/

title: Suzuki UC125


text:
Mathematical Proof

Table of Contents

 * 1) /Cover/
 * 2) /Preface/
 * 3) /Introduction to Set Theory/
 * 4) /Logic/
 * 5) /Methods of Proof/
 * 6) /Relations/
 * 7) /Functions/

title: Mathematical Proof


text:
Mathematical Proof/Introduction

If you've ever taken a math class or talked to a mathematician, you know that we don't talk like normal people do--we have our own language that's 2-bit encoded. For example, when a waiter says "Would you like corn or beans with your dinner?", you know that he wants the answer of "corn" or "beans" but not "both". Well, logically, if you ask the question "Would you like corn or beans with your dinner?", the answer could be "yes".

This chapter will acquaint you with logical statements, logical reasoning, and the cryptic language of mathematicians.

title: Mathematical Proof/Introduction


text:
Suzuki UC125/Battery

The battery is positioned at the front of the bike under the instrument panel. To access the battery for replacement or jump starting requires only a Phillips screw-driver and the removal of a few panels. The battery the bike ships with tends to work well for around 3 years in most situations, after which initially difficulty may be experienced with cold starts, and eventually starting becomes unreliable. Replacements are easily sourced from most Motorbike service outlets. As this bike has no kick start, it is advisable to ensure the battery is in good condition at all times.

Remove the front windshield panel by removing the two silver screws and lifting the panel upwards and off.

Remove the centre screw and the plastic rivets by turning then anti-clockwise with a screwdriver and then lifting them out.

Remove the four screws either side of the handlebars to release the instrument panel.

Unhook the battery strap and pull it out.

title: Suzuki UC125/Battery


text:
Windows Programming/Input-Output

Many of the previous chapters have attempted to shed some light on the Windows graphical interface, but this chapter is going to start a detour into the inner-workings of the Windows operating system foundations. In this chapter, we are going to talk about Input and Output routines. This includes (but is not limited to) File I/O, Console I/O, and even device I/O.

File API
Files, like everything else in a windows platform, are managed by handles. When you want to read a file or write to one, you must first open a handle to that file. Once the handle is open, you may use the handle in read/write operations. In fact, this is the same with all I/O, including console I/O and device I/O: you must open a handle for reading/writing, and you must use the handle to perform your operations.

CreateFile
We will start with a function that we will see frequently in this chapter: CreateFile. CreateFile is the generic function used to open I/O handles in your system. Even though the name doesn't indicated it, CreateFile is used to open Console Handles and Device Handles as well. As the MSDN documentation says:

The CreateFile function creates or opens a file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. The function returns a handle that can be used to access an object.

Now, this is a powerful function, and with the power comes a certain amount of difficulty in using the function. Needless to say, CreateFile is a little more involved than the standard C STDLIB fopen.

HANDLE CreateFile( LPCTSTR lpFileName,  DWORD dwDesiredAccess,  DWORD dwShareMode,  LPSECURITY_ATTRIBUTES lpSecurityAttributes,  DWORD dwCreationDisposition,  DWORD dwFlagsAndAttributes,  HANDLE hTemplateFile);

As can be guessed, the "lpFileName" parameter is the name of the file to be opened. "dwDesiredAccess" specifies the desired access permissions for the file handle. In the most basic sense, for a file, this parameter can specify a read operation, a write operation, or an execute operation. However, don't be fooled, there are many many different options that can be used here, for different applications. The most common operations are GENERIC_READ, GENERIC_WRITE, and GENERIC_EXECUTE. These can be bitwise-OR'd to have read+write access, if needed.

File handles can be optionally shared or locked. A shared file can be simultaneously opened and accessed by other processes. If a file is not shared, then other programs attempting to access the file will fail. The "dwShareMode" specifies whether or not the file can be accessed by other applications. Setting dwShareMode to zero means that the file access cannot be shared, and other applications attempting to access the file, while the file handle is open, will fail. Other common values are FILE_SHARE_READ and FILE_SHARE_WRITE which allow other programs to open read handles and write handles, respectfully.

The lpSecurityAttributes is a pointer to a SECURITY_ATTRIBUTES structure. This structure can help to secure the file against unwanted accesses. We will discuss security attributes in a later chapter. For now, you can always set this field to NULL.

The dwCreationDisposition member would be better named "dwCreateMode" or something similar. This bit flag allows you to determine how the file is to be opened, according to different flag values:

 * CREATE_ALWAYS:Always creates a new file. If the file exists already, it will be deleted, and overwritten. If the file does not exist, it is created.
 * CREATE_NEW:If the file exists, the function fails. Otherwise, creates a new file.
 * OPEN_ALWAYS:Opens the file, without erasing the contents, if the file exists. Creates a new file if the file does not exist.
 * OPEN_EXISTING:Opens the file, without erasing the contents, only if the file exists already. If the file does not exist, the function fails.
 * TRUNCATE_EXISTING:Opens the file, only if the file exists. When the file is opened, all the contents are deleted, and the file is set to 0 bytes long. If the file does not exist, the function fails. When opening with TRUNCATE_EXISTING, you must specify a GENERIC_WRITE flag as the access mode, or the function will fail.

The dwFlagsAndAttributes member specifies a series of flags for controlling File I/O. If the CreateFile function is being used to create something that isn't a File handle, this parameter is not used and may be set to 0. For accessing a normal file, the flag FILE_ATTRIBUTE_NORMAL should be used. However, there are also options for FILE_ATTRIBUTE_HIDDEN, FILE_ATTRIBUTE_READONLY, FILE_ATTRIBUTE_ARCHIVE, etc.

Finally, the hTemplateFile member can be specified if you want the new file handle to mimic the properties of an existing file handle. This can be set to NULL if not used.

ReadFile WriteFile
Once a file handle is opened, ideally we would like to interact with the specified file. We can do this most directly by using the ReadFile and WriteFile functions. Both of them take similar parameters:

BOOL ReadFile( HANDLE hFile,  LPVOID lpBuffer,  DWORD nNumberOfBytesToRead,  LPDWORD lpNumberOfBytesRead,  LPOVERLAPPED lpOverlapped);

BOOL WriteFile( HANDLE hFile,  LPCVOID lpBuffer,  DWORD nNumberOfBytesToWrite,  LPDWORD lpNumberOfBytesWritten,  LPOVERLAPPED lpOverlapped);

In both, the hFile parameter is the handle to the file that we obtained with CreateFile. The lpOverlapped parameter is used only for a special I/O mode known as "Overlapped I/O Mode", which we will discuss later. For simple I/O, the lpOverlapped parameter can be set to NULL.

In ReadFile, the lpBuffer is a pointer to a generic buffer to receive the data. This data may not be character data, so we don't call it a LPSTR type. "nNumberofBytesToRead" is the number of bytes that should be read, and "lpNumberOfBytesRead" is the actual number of bytes that were read. If lpNumberOfBytesRead is zero, the file has no more data in it.

In WriteFile, the lpBuffer parameter points to the data that should be written into the file. Again, it isn't specifically character data. nNumberOfBytesToWrite is the maximum number of bytes to write, and the lpNumberOfBytesWritten returns the number of bytes that were actually written to the file.

CloseHandle
When you are done with a file handle, you should close it with the CloseHandle function. CloseHandle only takes one parameter, the file handle you wish to close. If you do not close your handle, Windows will automatically close the handle when the program closes. However, it is a more expensive operation for Windows to do it for you, and can waste time on your system. It is a good idea to always explicitly close all your handles before you exit your program.

Failure to close a handle is known as "handle leaks", and are a common form of memory leakage that can cause your program, and your entire system, to lose resources and operate more slowly. The handle itself occupies only 32-bits of information, but internally the kernel maintains a large amount of data and storage for every handle. Failure to close a handle means that the kernel must maintain all the associated information about the handle. It also costs the kernel additional time and resources to check through all the old unused handles when it is looking for information about a current handle.

Memory-Mapped Files
Memory-Mapped files provides a mechanism to read and write to a file using regular pointers and array constructs. Instead of reading from the file using ReadFile, you can read from the file using a memory pointer. The system does this by reading in the file to a memory page, and then writing changes to that page onto the physical disk. There is a certain amount of additional overhead to read the file into memory at first, and to write it back after the mapping is completed. However, if there are many accesses to the file, it can be much more convenient in the long run.

Overlapped I/O
"Overlapped" I/O is the term Microsoft uses to describe asynchronous I/O. When you want to do I/O, either to a file or to an external device, you have two options:
 * Synchronous (non-overlapped):You request the I/O from the system, and wait till the I/O has completed. The program will stop running until the I/O has completed.
 * Asynchronous (overlapped):You send a request to the system, and the system completes that request in parallel with your program. Your program can continue to do processing work, and the system will automatically send notification when your request has been completed.

Synchronous I/O is much easier to use, and is much more straight forward. In synchronous I/O, things happen sequentially, and when the I/O function has returned, you know that the transaction is complete. However I/O is typically much slower then any other operation in your program, and waiting on a slow file read, or a slow communications port can waste lots of valuable time. In addition, if your program is waiting for a slow I/O request, the graphical interface will appear to hang and be non-responsive, which can annoy the user.

Programmers can avoid these delays by using dedicated threads or a thread pool to execute synchronous I/O operations. But threads have significant overhead, and creating too many of them exhausts system resources. Asynchronous I/O avoids this overhead, and is thus the preferable API for high-performance high-load server applications.

Asynchronous I/O is more complicated to use: It requires the use of the OVERLAPPED structure, and the creation of a handler function that will be called automatically by the system when the I/O is complete. However, the benefits are obvious in the efficiency of the method. Your program can request multiple transactions without having to wait for any of them to complete, and it can also perform other tasks while the system is performing the required task. This means that the programs will appear more responsive to the user, and that you can spend more time on data processing, and less time waiting for data.

Allocating a Console
A console can be allocated by calling the AllocConsole function. Normally we need not do so if we are creating a "console process" (which contains the main function) because they are already attached to a console. However we can create a console for "GUI process" (which entry point is WinMain) and perform I/O operation on the newly created console. It should be noted that each process can only be associated with one console. If the process has already attached to a console, calling AllocConsole will return FALSE.

After calling AllocConsole, the Windows Command Prompt window will appear.

A console can be freed by calling FreeConsole.

Getting a Console Handle
Upon the creation of console, the standard output, standard input and standard error handles (we call them the "standard devices") will be initialized. These handles are essential for any console I/O operations. They can be obtained by calling GetStdHandle, which accepts a parameter specifying the handle of the standard device to be obtained. The parameter can be any of the following: If the function succeeded, the return value is the handle to the standard device specified. If failed, it will return INVALID_HANDLE_VALUE.
 * STD_OUTPUT_HANDLE:Specifies the standard output device, which is used for outputting data to the console.
 * STD_INPUT_HANDLE:Specifies the standard input device, which is used for reading input from the console.
 * STD_ERROR_HANDLE:Specifies the standard error device, which is mainly used for outputting error.

High Level I/O
The  or   (C++ only) header files contain the functions typically used for high level console I/O. The high level I/O are typically "buffered". Such functions including printf, scanf, fgets etc. If we wish to do unbuffered I/O, we can use the fread or fwrite functions and pass stdin, stdout or stderr to the parameter specifying the standard input, standard output and standard error devices respectively. It is generally not advisable to combine the use of both high level and low level I/O however.

These functions are designed to be portable and act as an abstraction to the low level system I/O functions.

Low Level I/O
The low level console I/O can be done by using several API functions such as WriteConsole, ReadConsole, ReadConsoleInput etc.

BOOL WriteConsole( HANDLE hConsoleOutput,  const VOID *lpBuffer,  DWORD dwNumberOfCharsToWrite,  LPDWORD lpNumberOfCharsWritten,  LPVOID lpReserved );

BOOL ReadConsole( HANDLE hConsoleInput,  LPVOID lpBuffer,  DWORD dwNumberOfCharsToRead,  LPDWORD lpNumberOfCharsRead,  LPVOID pInputControl );

Please note that the "Chars" referred is actually the number of TCHAR, which can be 2-bytes wide when UNICODE is defined. It is NOT the number of bytes.

The ReadConsoleInput can be used to read keystrokes, which can't be done with C or C++ standard library. There are many more functions which provide powerful I/O functions.

Colors and Features
There are many exciting API functions that provide additional controls over the console. One of the more commonly used function is the SetConsoleTitle which is used to set the console title text. We can also alter the position of the cursor by using the SetConsoleCursorPosition function.

We can output text with different foreground and background colors by SetConsoleTextAttribute. We can also change the size of the screen buffer by SetConsoleScreenBufferSize.

For an extensive documentation of all the Console API one can consult MSDN.

Device IO API
Interaction between a program and a device driver can be complicated. However, there are a few standard device drivers that may be used to access standard ports and hardware. In most instances, interacting with a port or a piece of hardware is as easy as opening a handle to that device, and then reading or writing to it like a file. In most instances, these ports and devices can be opened using the CreateFile function, by calling the name of the device instead of the name of a file.

Device IO Functions
Device IO function.

Next Chapter

 * File Management

title: Windows Programming/Input-Output


text:
Windows Programming/File Management

This chapter will discuss some of the details of file and directory management. Some topics discussed will include moving and deleting files and directories, enumerating files, locking files, encrypting files, and accessing the Recycle Bin.

File Attributes
File attributes can be used to write-protect, hide, and un-hide files, or as behind-the-scenes file maintenance. This information can be accessible using the GetFileAttributes function. The attributes are called Read Only, Hidden, Archive, and System, and are described below:

Read Only: A file that is marked Read Only cannot be altered. It can be read, but it cannot be changed or deleted.

Hidden: By default, hidden files do not appear in a directory listing.

Archive: The Archive attribute can be used to selectively back up or copy files; it is most helpful in DOS.

System: System files are files flagged for use by the operating system and are not usually displayed in a directory listing.

Copying, Moving and Renaming Files
To copy files or directory there are two functions: CopyFile and the extended CopyFileEx.

BOOL CopyFile(   LPCTSTR lpExistingFileName, // ptr to the name of the file/directory to copy    LPCTSTR lpNewFileName,	// ptr to filename to copy to     BOOL bFailIfExists   	// flag for operation if file exists    );

lpExistingFileName: is a pointer to a string that contains the file/directory to copy

lpNewFileName: is a pointer to a string with the new file/directory path

bFailIfExists: if this parameter is TRUE and the new file already exists, the function fail; if it is FALSE it will overwrite the existing file/directory.

If the function fail, the return value is zero, otherwise nonzero.

CopyFileEx is a bit more complicated. You can also specify a callback routine that is called each time a portion of the file has been copied. You can also cancel the copy operation, and if you want restart it later.

BOOL CopyFileEx(   LPCWSTR lpExistingFileName,	    // pointer to name of an existing file    LPCWSTR lpNewFileName,	    //pointer to filename to copy to    LPPROGRESS_ROUTINE lpProgressRoutine,	// pointer to the callback function    LPVOID lpData,	           //data to be passed to the callback function    LPBOOL pbCancel,	           //flag that can be used to cancel the operation    DWORD dwCopyFlags	           //flags that specify how the file is copied   );

lpProgressRoutine: You can set a callback function, so that it is called every time a portion of the file has been copied (it must be in the PROGRESS_ROUTINE form, see below).

lpData: Data to pass to the callback function (can be NULL).

pbCancel: if this flag is set to TRUE during the copy operation, the operation is cancelled.

dwCopyFlags: Specifies how the file is copied. Can be a combination of the following values

COPY_FILE_FAIL_IF_EXISTS The copy operation fail if lpNewFileName already exists

COPY_FILE_RESTARTABLE  The copy progress is tracked in the file. You can restart the copy  process later using the same values for lpExistingFileName and lpNewFileName

The definition of the copy progress routine:

DWORD WINAPI CopyProgressRoutine(

LARGE_INTEGER TotalFileSize,	       // total file size of the file, in bytes LARGE_INTEGER TotalBytesTransferred,  // total number of bytes transferred since operation started LARGE_INTEGER StreamSize,	          // size of current stream, in bytes LARGE_INTEGER StreamBytesTransferred,	// total number of bytes transferred for this stream DWORD dwStreamNumber,	// the current stream DWORD dwCallbackReason,	// reason for callback HANDLE hSourceFile,	// handle to the source file HANDLE hDestinationFile,	// handle to the destination file LPVOID lpData	// data passed by CopyFileEx );

You can use the first four parameters to display an indicator showing the percentage completed of the process.

dwCallbackReason: can have the following values

CALLBACK_CHUNK_FINISHED	Another part of the data was copied.

CALLBACK_STREAM_SWITCH	A stream was created and it is about to be copied. This is the reason when the Copy Routine Callback is called for the first time.

This function must return one of the following values:

PROGRESS_CONTINUE Continue with the copy

PROGRESS_CANCEL   Cancel the copy operation and delete the target file

PROGRESS_STOP	  Stop the operation (it can be restarted later)

PROGRESS_QUIET	  Continue the copy operation, but don't call the Copy Progress Routine Again

---

Now, let's see how to move and rename files. The function we need are MoveFile and MoveFileEx. These function are used to both move or rename a file. When you call one of these function the system simply copy the file to the new location (with a different name if you also rename it) and deletes the old file.

BOOL MoveFileEx(   LPCTSTR lpExistingFileName,	// address of name of the existing file      LPCTSTR lpNewFileName,	// address of new name for the file     DWORD dwFlags 	       // flag to determine how to move file    );

Deleting Files
The API function used to delete files is DeleteFile. The file to delete must be closed, or the function will fail. If the function fails, the return value is 0, if it succeeds it's nonzero.

BOOL DeleteFile(       LPCTSTR lpFileName 	// pointer to name of file to delete     );

To delete a directory you can use the RemoveDirectory function, but first you have to delete all it's files and subdirectoryes (it must be empty).

BOOL RemoveDirectory(        LPCTSTR lpPathName 	// address of directory to remove     );

Directory changes
ReadDirectoryChangesW can be used to watch a directory (or volume). It can pass notifications when some file action is done in the target directory.

Compressing Files
msdn

Next Chapter

 * Memory Subsystem

title: Windows Programming/File Management


text:
Mathematical Proof/Appendix/Answer Key

This appendix contains all the answers for the book (or, it will once I've finished it). No cheating. Do the problems first and then check your answers. Or you'll get an F.

 * 1.1 Logical Reasoning
 * 1.2 Notation
 * 2.1 Constructive Proof
 * 2.2 Proof by Contrapositive
 * 2.3 Proof by Contradiction
 * 2.4 Proof by Induction
 * 2.5 Counterexamples

title: Mathematical Proof/Appendix/Answer Key


text:
Mathematical Proof/Logic

As discussed in the introduction, logical statements are different from common English. We will discuss concepts like "or," "and," "if," "only if." (Here I would like to point out that in most mathematical papers it is acceptable to use the term "we" when referring to oneself. This is considered polite by not commanding the audience to do something nor excluding them from the discussion.)

Truth and statement
We encounter frequently in mathematics.

For the sentences that are not statements, there is a special type of sentences among them, namely.

To express all possible combinations of of some statements, we usually list them in a table, called a.

Conjunction, disjunction and negation
In this section, we will discuss some ways (conjunction and disjunction) to combine two statements into one statement, which is analogous to ../Introduction to Set Theory, in which two sets are combined into one set. Also, we will discuss a way (negation) to change a statement to another one.

Negations
To negate a statement, we usually add the word "not" into a statement, or delete it from a statement. For example, the negation of the statement "The number 4 is even." is "The number 4 is even.", and the negation of the statement "The number 1 is not prime." is "The number 1 is not prime."

Conditionals
Apart from the above ways to form a new statement, we also have another very common way, namely the "if-then combination". The statement formed using the "if-then combination" is called a.

To understand more intuitively why the conditional is always true when the hypothesis is false, consider the following example.

Converse and biconditionals
After discussing of $$P$$ and $$Q$$, we will discuss  of $$P$$ and $$Q$$. As suggested by its name, there are conditionals involved. The conditional involved, in addition to $$P\to Q$$, is $$Q\to P$$, which is called the  of the conditional $$P\to Q$$.

In mathematics, given that the conditional $$P\to Q$$ is true, we are often interested in knowing whether its $$Q\to P$$ is true as well.

Implication and logical equivalence
When the conditional $$P\to Q$$ is, we can say "$$P$$ $$Q$$", denoted by $$P\Rightarrow Q$$. On the other hand, when $$P$$ does imply $$Q$$, i.e. $$P\to Q$$ is, we denote this by $$P\nRightarrow Q$$.

We have some other equivalently ways to say "$$P$$ implies $$Q$$", namely
 * $$P$$ is a for $$Q$$ (or $$P$$ is sufficient for $$Q$$ in short)
 * We call $$P$$ to be for $$Q$$ since when $$P$$ implies $$Q$$, then "$$P$$ is true" is  to deduce "$$Q$$ is true".

 * $$Q$$ is a for $$P$$ (or $$Q$$ is necessary for $$P$$ in short)
 * We call $$Q$$ to be for $$P$$ since when $$P$$ implies $$Q$$, the hypothesis cannot be possibly true when the consequent $$Q$$ is false (or else the conditional $$P\to Q$$ will be false). This explains the  of "$$Q$$ is true".

When $$P\Rightarrow Q$$, we are often interested knowing whether the of $$P\to Q$$ is true or not, i.e. whether we have $$Q\Rightarrow P$$ or not.

In the case where $$P\Rightarrow Q$$ but $$Q\nRightarrow P$$, we have multiple equivalent ways to express this:
 * $$P$$ is for $$Q$$.
 * From the previous interpretation, when we say $$P$$ is necessary for $$Q$$, we mean $$Q\Rightarrow P$$. Hence, when $$P$$ is sufficient but not necessary for $$Q$$, we mean $${\color{blue}P\Rightarrow Q}$$ and $${\color{red}Q\nRightarrow P}$$.

 * $$P$$ is a than $$Q$$ (or $$P$$ is  than $$Q$$ in short).

In the case where $$P\Rightarrow Q$$ and $$Q\Rightarrow P$$ as well, the biconditional $$P\leftrightarrow Q$$ is also true, and we denote this by $$P\Leftrightarrow Q$$. There are also multiple equivalent ways to express this:
 * $$P$$ is $$Q$$.
 * We say they are equivalent since they always have the same truth values (because $$P\leftrightarrow Q$$ is true), which is related to.

 * "$$P$$ $$Q$$" (is true).
 * Recall that we also use "$$P$$ if and only if $$Q$$" to express the $$P\leftrightarrow Q$$. Thus, technically, we should write "$$P$$ if and only if $$Q$$" is true in the case where $$P\Leftrightarrow Q$$. However, we rarely write this in practice, and usually omit the phrase "is true" since it makes the expression more complicated. So, when we write "$$P$$ if and only if $$Q$$" in this context, we mean that the biconditional is true without saying it explicitly.
 * Usually, when we just write "$$P$$ if and only if $$Q$$", we have the meaning of the logical equivalence $$P\Leftrightarrow Q$$, rather than the statement $$P\leftrightarrow Q$$. If we really want to have the latter meaning, we should specify that "$$P$$ if and only if $$Q$$" refers to a.

 * $$P$$ is for $$Q$$.
 * Following the previous interpretation, $$P$$ is necessary and sufficient for $$Q$$ means $${\color{blue}Q\Rightarrow P}$$ and $${\color{red}P\Rightarrow Q}$$.

Tautologies and contradictions
Before defining what tautologies and contradictions are, we need to introduce some terms first. In the previous sections, we have discussed the meaning of the symbols $$\sim,\lor,\land,\to$$ and $$\leftrightarrow$$. These symbols are sometimes called , and we can use to make some complicated statements. Such statements, which are composed of at least one given (or component) statements (usually denoted by $$P,Q,R$$ etc.) and at least one logical connective, are called.

Quantifiers
Recall that an is a sentence whose truth values depends on the input of certain variable. In this section, we will discuss a way to change an open statement into a statement, by "restricting the input" using quantifiers, and such statement made is called an quantified statement. For example, consider the statement "The square of each real number is nonnegative.". It can be rephrased as "For each real number $$x$$, $$x^2\ge 0$$." We can let $$P(x)$$ be the "$$x^2\ge 0$$". Then, it can be further rephrased as "For each real number $$x$$, $$P(x)$$." In this case, we can observe how an open statement ($$P(x)$$) is converted to a statement (For each real number $$x$$, $$P(x)$$), and the phrase "for each" is a type of the. Other phrases that are also universal quantifiers include "for every", "for all" and "whenever". The universal quantifier is usually denoted by $$\forall$$ (an inverted "A"). After introducing this notation, the statement we mention can be further rephrased as "$$\forall x\in\mathbb R,x^2\ge 0$$" (we also use some set notations here).

In general, we can use the universal quantifier to change an open statement $$P(x)$$ to a statement, which is "$$\forall x\in S,P(x)$$" in which $$S$$ is a (universal) set (or domain) which restricts the input $$x$$.

Apart from the universal quantifier, another way to convert an open statement into a statement is using an. Each of the phrases "there exists", "there is", "there is at least one", "for some", "for at least one" is referred to as an , and is denoted by $$\exists$$ (an inverted "E"). For example, we can rewrite the statement "The square of some real number is negative." as "$$\exists x\in\mathbb R, x^2 < 0.$$" (which is false).

In general, we can use the existential quantifier to change an open statement $$P(x)$$ to a statement, which is "$$\exists x\in S,P(x)$$" in which $$S$$ is a (universal) set (or domain) which restricts the input $$x$$.

Another quantifier that is related to quantifier is the. Each of the phrases "there exists a unique", "there is exactly one", "for a unique", "for exactly one" is referred to as, which is denoted by $$\exists !$$. For example, we can rewrite the statement "There exists a unique real number $$x$$ such that $$2x=0$$." as "$$\exists !x\in\mathbb R, 2x=0$$." We can express the unique existential quantifier in terms of existential and universal quantifiers, by "$$\exists !x\in S, P(x)$$" as $$\left(\exists x\in S,P(x)\right)\land \left(\forall x_1,x_2\in S,P(x_1)\land P(x_2)\to x_1=x_2\right)$$ where the left bracket is the existence part, and the right bracket is the uniqueness part. In words, the expression means
 * There exists $$x\in S$$ such that $$P(x)$$, AND for every $$x_1,x_2\in S$$, if $$P(x_1)$$ and $$P(x_2)$$, then $$x_1=x_2$$ (i.e., $$x_1$$ and $$x_2$$ are actually referring to the same thing, so there is $$x$$ such that $$P(x)$$).

In general, we need to separate the existence and uniqueness part as above to prove statements involving unique existential quantifier.

Negation of quantified statements
From this example, we can see that the negation of the statement "$$\exists x\in S,P(x)$$" is logically equivalent to "$$\forall x\in S,\sim P(x)$$". Now, it is natural for us to want to know also the negation of the statement "$$\forall x\in S,P(x)$$. Consider this: when it is not the case that $$P(x)$$ is true for each $$x\in S$$, it means that $$P(x)$$ is false for $$x\in S$$. In other words, $$\exists x\in S,\sim P(x)$$. Hence, we know that the negation of the statement "$$\forall x\in S,P(x)$$" is logically equivalent to $$\exists x\in S,\sim P(x)$$.

Quantified statements with more than one quantifier
A quantified statement may contain more than one quantifier. When only one type of quantifier is used in such quantified statement, the situation is simpler. For example, consider the statement "For each real number $$x$$ and for each real number $$y$$, $$xy$$ is a real number." It can be written as "$$\forall x\in\mathbb R,\forall y\in\mathbb R,xy\in\mathbb R$$". When we interchange "$$\forall x\in\mathbb R$$" and "$$\forall y\in\mathbb R$$", the meaning of the statement is not affected (the statement still means "The product of two arbitrary real numbers is a real number.") Because of this, we can simply write the statement as "$$\forall x,y\in\mathbb R,xy\in\mathbb R$$" without any ambiguity.

For an example that involve two existential quantifiers, consider the statement "There exists an real number $$x$$ and an real number $$y$$ such that $$xy$$ is a real number." It can be written as "$$\exists x\in\mathbb R,\exists y\in\mathbb R,xy\in\mathbb R$$." Similarly, interchanging "$$\exists x\in\mathbb R$$" and "$$\exists y\in\mathbb R$$" does not affect the meaning of the statement (the statement still means "For at least one pair of real numbers $$x$$ and $$y$$, $$xy$$ is a real number.") Because of this, we can simply write the statement as "$$\exists x,y\in\mathbb R,xy\in\mathbb R$$" without any ambiguity.

However, when both types of quantifier are used in such quantified statement, things get more complicated. For example, consider the statement "For each integer $$x$$, there exists an integer $$y$$ such that $$y<x$$." This can also be written as "$$\forall x\in\mathbb Z,\exists y\in\mathbb Z, y<x$$". It means that for each integer, we can find a (strictly) smaller one, and we can see that this is a true statement. For instance, if you choose $$x=13$$, I can choose $$y=-99,0$$ or $$12$$. Indeed, for the integer $$x$$ chosen by you, I can always choose my $$y$$ as $$x-1$$ so that $$y<x$$.

Let's see what happen if we interchange "$$\forall x\in\mathbb Z$$" and "$$\exists y\in\mathbb Z$$". The statement becomes $$\exists y\in\mathbb Z,\forall x\in\mathbb Z,y<x$$, meaning that there exists an integer $$y$$ such that it is (strictly) smaller than integer $$x$$! This is false, since, for example, there is no integer that is (strictly) smaller than itself (which is an integer). In this example, we can see that interchanging the positions of universal quantifier and existential quantifier can change the meaning of the statement. Hence, it is very important to understand clearly the meaning of a quantified statement with both universal and existential quantifiers. To ease the understanding, here is a tips for reading such statement:
 * For the variable associated to the quantifier $$\exists$$, it depend on the variable(s) introduced earlier in the statement, but  be independent from the variable(s) introduced later in the statement.

What does it mean? For example, consider the above example. , we have $$\forall x\in\mathbb Z,\exists y\in\mathbb Z,y<x.$$. Then, since the variable $$x$$ appears than the variable $$y$$ which associated to $$\exists$$, $$y$$  on $$x$$ (This is similar to the case in English. In a sentence, a thing may depend on other things mentioned earlier.). For instance, when you choose $$x=13$$, and I choose $$y=12$$. Then, $$y<x$$. However, if you change your choice to $$x=9$$, then my $$y=12$$ does not work, and I need to change my $$y$$ to, say, 8 so that $$y<x$$. Then, we can see that $$y$$ depends on $$x$$ in this case. , we have $$\exists y\in\mathbb Z,\forall x\in Z, y<x$$. In this case, the variable $$x$$ appears than the variable $$y$$. Hence, the variable $$y$$ must be independent from from $$x$$. That is, when such $$y$$ is determined, it needs to satisfy $$y<x$$ for each $$x$$ chosen, and the $$y$$ cannot change depend on what $$x$$ is. Indeed, $$y$$ cannot depend on $$x$$, since $$y$$ is supposed to be determined when $$x$$ is not even introduced!

Exercises
In the following questions, $$P,Q,R,S$$ are statements.

A. Construct the truth tables for each the following statements, and also give its converse and contrapositive: B. Negate the following statements:
 * 1) $$\sim P \to Q $$
 * 2) $$P \to (\sim Q) $$
 * 3) $$(P\lor Q)\to R$$
 * 4) $$(P\land Q)\to (R\lor S)$$
 * 5) $$(R\to S)\to (P\to Q)$$
 * 1) $$ P \land Q$$
 * 2) $$ (P \lor Q)\land (R \land S)$$
 * 3) $$ (P \land \sim Q)\lor (\sim R\lor S)$$

title: Mathematical Proof/Logic


text:
Mathematical Proof/Appendix

 * Answer Key
 * Symbols Used in this Book
 * Glossary

title: Mathematical Proof/Appendix


text: Template:Mathematical Proof/navigation

title: Template:Mathematical Proof/navigation


text:
Talk:A-level Computing 2009/AQA

Contributors

 * User:pluke
 * User:Jamesgreenwood

To do List
create a general hints and tips page
 * do not round the 1s and 0s off numbers, if the question asks for 8 bits or uses 8 bits in it, answer in 8 bits!
 * do not use brand names in answering questions, give a generic answer such as office software, NOT MS Office

I have started this page as an appendix

I found this wikibook whilst contemplating creating my own wikibook for the HIGCSE Computer Studies curriculum, which I teach at a local school. My thought is to co-develop the book with my students. It would make more sense, though to collaborate on this wikibook, provided it is not intended to be totally A-Level specific. Since I am not familiar with the A-level syllabus, I can't even attempt to guess.

Is it going to be possible to generalise this text to cover A, AS and H(I)GCSE? or would it be better for me to start something different?

 * I think it would be best to keep the books separate (as they cover different syllabuses), but they can (and, from what you're saying, probably should) borrow heavily from each other. If you code into a page the text the Main Page (as updated from time to time) will appear on that page. This allows you to borrow and share whole pages of the wikibook, if desired. I don't know much about computing, and I don't know what HIGCSE is, but it's perfectly reasonable, to have a page HIGCSE Computing/Processing and Programming Techniques/Operating Systems that only contains the text , Jguk 09:40, 17 February 2006 (UTC)

 * I started this page and am planning to put a lot of work into it over the next year as i cover the course with my students. I would love to hear what modules your course comprises of and see if we can share any chapters.  Would be great to have some more people working on this --Pluke 20:31, 25 February 2006 (UTC)

I will be doing the A-Level course from 2006-8 on GNU/Linux, so hopefully I can contribute to the LAMP section (I am planning to use a similar system for one of the projects.) I also have some ideas for possible projects, and I would like to keep UNIX methods (such as ./configure and make to compile a custom project from the source) on this technical course. Uncle Lemon 20:03, 5 April 2006 (UTC)

I will be teaching this syllibus next year (after a few years of edexcel). I plan to encorage my students to contribute. if other teachers out their want to collaberate, please get in touch. As a department we are planning to use MS Access for the AS project and Visual Basic for the A2 project. Any advice is welcome.. especially for the AS project. --Joe mc h 22:34, 4 May 2006 (UTC)

Useful Links
http://news.bbc.co.uk/1/hi/programmes/click_online/default.stm
 * synthesizer

Syntax highlighting?
I imagine that the marvellous syntax highlighting extension at Wikibooks is very helpful to students. However, do AQA and OCR include syntax highlighting in the printed program listings in the exam papers? If so not, could this black-and-white presentation disorient or disadvantage students who are used to relying on syntax highlighting in their editors and textbooks? --InfantGorilla (discuss • contribs) 14:59, 31 January 2012 (UTC)

 * A very interesting question. When I get around to finishing the programming section I might set all the questions with no highlighting.  Also, I'm working on a printable version of the book that will probably be black and white.  Pluke (discuss • contribs) 15:32, 31 January 2012 (UTC)

 * Sounds like a useful compromise. I imagine the printable version will render the coloured text in grayscale, unless you set a rendering option to force it all to be black and white, which will probably work better on older printers or for readers with poor eyesight. --InfantGorilla (discuss • contribs) 16:17, 31 January 2012 (UTC)

Unicode
The UTF table on the unicode page has various comfusions about lengths. Whilst 256 is the number of values in a 8 bit variable, UTF-8 uses 1 byte for the first 128 values and multiple bytes for higher values. It is designed to have a maximum of 34359738367 with 6 bytes to match UTF-16. UTF-16 can use two or four bytes depending on value. The Textbook only talks about UCS-2 which is a far simpler encoding. Would it be better to refactor the page into just UCS 2, provide more explenation or remove the lengths. 31.222.208.187 (discuss) 13:00, 28 February 2013 (UTC)
 * Hi, thanks for raising this. I'm keen to keep the other formats in there to give as full an overview of the format as possible. I'll take a look and respond more fully in the next few days.  I see you have been editing a few pages, thanks for the help.  Are you based in the UK?  Please feel free to register a user account, it gives you lots of options with editing.  Thanks Pluke (discuss • contribs) 13:32, 28 February 2013 (UTC)
 * I've made it a little clearer what variable length means and dropped the misleading character numbers. Let me know if it makes sense and thanks for the feedback Pluke (discuss • contribs) 12:10, 8 March 2013 (UTC)
 * THats an improvement Tycho (discuss • contribs) 11:34, 20 March 2013 (UTC)

It may be better to take out the maximums as they do not to correspond to the variable width encodings. I am based in the UK and am currently studying the course. Tycho (discuss • contribs) 15:54, 1 March 2013 (UTC)

SQL Injection
The SQL Injection page A-level Computing/AQA/Problem Solving, Programming, Operating Systems, Databases and Networking/Databases/Security gives an example on how to protect against SQL injection that does not protect against SQL injection. It uses the mysql_real_escape_string function (Which is deprecated) to generated an escaped string but does not put it in quotes in the SQL so the escapes don't matter. mysql_real_escape_string will not escape any of the text in the string as it is all valid in a quoted string. The function is for things like ". I would make the edit but this page has a large number of issues including depreciated functions, an example that wont work as mysql will only execute one statement per query and the hashing section that implys md5 is a good function when sha2 is really now the minimum and doesn't mention salting. I would like to discuss the page before making large changes. Edits I am considering are moving the whole thing to to pseudo-code as there is all most no PHP on the site, talking about escaping and validation more generraly and updating the hashing function. --Tycho (discuss • contribs) 11:26, 2 May 2013 (UTC)

 * Hi Tycho, please jump straight in, this page is very uncared for at the moment and on my todo list for the summer. The material is largely out of date and a move to pseudo code would be welcomed.  Edit away and I'll help where I can. Pluke (discuss • contribs) 09:55, 4 May 2013 (UTC)

Extreme/Boundary Testing
I was told by my teacher today regarding my Comp 4 that in the testing table the data should be referred to as Boundary Data and not Extreme Data. This also comes up in Comp 1. Do you agree this needs changing? --Drumncars1996 (discuss • contribs) 19:44, 12 May 2014 (UTC)

 * Hi Drumncars1996, the words are interchangeable, but if the exam uses Boundary, then change it to boundary and I'll approve your edit. Thanks for helping out! Pluke (discuss • contribs) 20:42, 12 May 2014 (UTC)

Definitions List
I think it would be helpful to have a page collating all definitions for each of the units. I would gladly put some of the ones I have collected but I don't believe there is currently a page devoted to definitions. Do you agree that this would be useful? J Cobbles (discuss • contribs) 08:47, 25 May 2014 (UTC)
 * Sounds like a very good idea. Do you want to start a page or would you like me to set one up for you? Pluke (discuss •

contribs) 12:13, 25 May 2014 (UTC)
 * If you could set one up, that would be great, I'm not sure I have permission to set one up myself, I'm fairly new to wiki contributions. Thanks J Cobbles (discuss • contribs) 08:17, 31 May 2014 (UTC)
 * Added, check them out:
 * UNIT1
 * UNIT2
 * UNIT3

merge
At the moment, the A-level Computing 2009 Wikibook and the A-level Computing Wikibook are mostly word-for-word identical.

Are there enough good reasons to keep them separate, or should they be merged? --DavidCary (discuss • contribs) 00:35, 12 August 2016 (UTC)

ːThe 2009 book is there as a snap shot of the text for people completing the old specification. The specification has significantly changed and as there were students doing the 2009 and the 2015 specifications at the same time it was felt that a 2009 book should be maintained separately. Now the 2009 specification has deprecated, there is an argument for combining both books, though others might want to have the old 2009 book layout and content to remain where it can be used. Pluke (discuss • contribs) 18:08, 12 August 2016 (UTC)

Anti-Vandalism
Surely it makes sense to protect important pages respectively, such as predicted questions, rather than rely simply on trust to stop vandalism. Finnh54 (discuss • contribs) 09:27, 14 December 2020 (UTC)

title: Talk:A-level Computing 2009/AQA


text:
Mathematical Proof/Introduction/Notation

While a comprehensive list of notation is included in the appendix, that is meant mostly as a reference tool to refresh the reader of what notation means. This section is to introduce the notation to the reader and explain its usage.

Basic Set Theory
This is not meant to be a comprehensive or rigorous definition of set theory. We will define a minimal amount of set-theoretical objects, so that the concept of mathematical thinking can be understood. In this book, we will use capital letters for sets and lowercase letters for elements of sets. This convention is not to discourage creativity or to bore your socks off, but to avoid confusion.

Axioms
An axiom is something that is assumed, or believed to be true. It is where mathematical proof starts; you cannot prove the axioms, you merely believe them and use them to prove other things. There are different sets of axioms, the most current and widely-used being Zermelo–Fraenkel set theory. I will give a list of axioms here that will suffice for the studies in this book.

 * 1) A set exists. (A set, for our purposes, will be a collection of objects that we will call elements.  A set is said to contain its elements, and the elements are said to be contained in the set.)
 * 2) An empty set exists. This set will be denoted as $$\varnothing$$ and will contain no elements.
 * 3) Two sets are equal if and only if they contain the same elements.
 * 4) If $$A$$ and $$B$$ are sets, then there is a set containing only the elements of $$A$$ and $$B$$. This is called the union of $$A$$ and $$B$$.
 * 5) If $$A$$ is a set and $$P(x)$$ is a truth statement defined for all $$x$$ contained in $$A$$, then there is a set $$B$$ so that $$x$$ is in $$B$$ whenever $$P(x)$$ is true.
 * 6) The set of counting numbers $$(1,2,3,\dots)$$ exists; or, an infinite set exists.

Some of these are worded rather formally, which is a tendency for mathematicians. First of all, let's explain why we need these axioms.

The first axiom says "a set exists." So you might ask—don't we know that it exists? Can't we just define it to exist? The answer is, yes, and that's why it's an axiom. Axioms are supposed to be self-evident truths. Now that we've established the fact that sets exist, why would we want one with no elements? Well, the empty set turns out to be both a very useful and a very annoying set. You'll learn to be good friends with the empty set by the end of the text.

Axiom 3 could be considered a definition, rather than an axiom, of what we mean when we say that two sets are equal. Axiom 4 just says that if we have two sets then we can get a new set with all of those elements in it. For example, the set of all people and all dogs.

The fifth axiom is probably the most confusing. All it says is that if we have a set and we want to pick out certain elements, we can do that. For example, out of the set of all integers, we can choose the ones that are even, or the ones that are positive, or the ones that are perfect squares.

Finally, the infinity axiom is nice because we will do lots of things with infinite sets.

Definitions
As mentioned above, a set will be a collection of elements. For example, let $$A$$ be the set of all cheesecakes, and let $$B$$ be the set of all things that are chocolate. Mathematically, this would be denoted as: $$A = \{x|x \mbox{ is a cheesecake}\}$$ $$B = \{x|x\mbox{ is chocolate}\}$$

The vertical bar | is read "such that". We can select elements in that way by using Axiom 5 from above. In the case of $$A$$, the predicate (truth statement) $$P(x)$$ used to select elements is: $$P(x)\ :\ x \mbox{ is a cheesecake}$$

Note that we have implicitly assumed the existence of a universal set of all elements over which we are making a selection. In the example above, this universal set could be the set of all pastries. In general, if a universal set is not specified, we shall assume that we are talking about the real numbers $$\mathbb{R}$$. Thus, $$C = \{x | x > 2\}$$ can be read as: "$$C$$ is the set of all real numbers strictly greater than $$2$$."

To say that $$x$$ is an element of $$A$$ is equivalent to saying that $$A$$ contains $$x$$. These concepts are notated mathematically by $$x\in A$$ (x belongs to the set A) and $$A\ni x$$. If $$x$$ is not a member of $$A$$ then we write $$x\notin A$$ (x does not belong to the set A).

The union of $$A$$ and $$B$$ is defined in axiom 4. It consists of all the elements in $$A$$ and $$B$$ and is denoted $$A\cup B$$. We can also use the | to say $$A\cup B = \{x|x\in A \mbox{ or } x\in B\}=\{x|x \mbox{ is a cheesecake or is chocolate}\}$$

The intersection of $$A$$ and $$B$$ is the set containing all things that are in both $$A$$ and $$B$$. The notation for this is $$A\cap B$$. $$A\cap B = \{x|x\in A \mbox{ and }x\in B\}=\{x|x\mbox{ is a chocolate cheesecake}\}$$

If $$A\cap B = \varnothing$$ then $$A$$ and $$B$$ are said to be disjoint. This means that there is nothing that is in both sets. For example, if $$A$$ is the set of all even integers and $$B$$ is the set of all odd integers, then they are disjoint.

Notice that the logical connectors $$\lor,\land$$ coincide with the set operators $$\cup, \cap$$. This is deliberate, since the concepts are related. This is obvious when the two symbols are juxtaposed: $$A\cup B = \{x|(x\in A) \lor (x\in B)\}$$ $$A\cap B = \{x|(x\in A) \land (x\in B)\}$$

Quantifiers
Quantifiers are used to establish what elements are currently being discussed. They are like adjectives in English—they tell how much or what kind of thing we're talking about.

For All
The most common quantifier is for all. This is written mathematically as $$\forall$$. It is also "for each" or "for every." It is used to make statements like "All humans have eyeballs." That is, if $$H$$ is the set of all humans and $$E$$ is the set of all things with eyeballs, then $$\forall x\in H, x\in E$$ which is read "For all $$x$$ in $$H$$, $$x$$ is in $$E$$." This introduces a special relationship between sets that is called a subset. In this case, $$H$$ is a subset of $$E$$ since every element of $$H$$ is also in $$E$$. (For the sake of the logical argument, just assume there aren't any people without eyeballs.) We write this as $$H\subset E.$$ This notation, $$A\subset B$$, is ambiguous because some authors use it to mean just a subset, while others use it to mean a proper subset (meaning there is an element of $$B$$ that is not in $$A$$, and thus $$A$$ and $$B$$ are not equal) and use $$A\subseteq B$$ to denote that $$A$$ is a subset of $$B$$. In this book we will go with the convention that $$A\subset B$$ could mean that $$A$$ is a proper subset of $$B$$ or that $$A$$ = $$B$$, and we will use $$A\subsetneq B$$ when we wish to emphasize that $$ A\ne B$$.

There Exists
This is probably as common as for all and is equally useful. Its mathematical symbol is $$\exists$$. It is almost always followed by a "such that" statement. For example, "There exists a computer that has 8GB of RAM." $$\forall$$ and $$\exists$$ are often used in pairs, such as, "Everyone has a mother.", or, worded logically, "For each human, there exists a mother for that human.". Let H be the set of all humans and M be the set of all mothers. Then we have $$\forall h \in H, \exists m \in M \mbox{ such that }m\mbox{ is the mother of }h. $$ or, when $$H$$ and $$M$$ are understood, $$\forall h, \exists m \mbox{ such that }m\mbox{ is the mother of }h.$$

This quantifier is also read as there is or there are. To signify that there is only one of something, we say "There exists a unique..." and place an exclamation point after the exists symbol: $$\exists !$$.

In the same way that "not and" gives "or", "not for all" gives "there exists." That is, the opposite of the statement "All cheesecakes are chocolate." is "There is a cheesecake that is not chocolate." In logical terms, $$\lnot (\forall x\in A, P(x))\mbox{ is equivalent to }\exists x\in A : \lnot P(x).$$

The above statement is read "the negation of 'For all x in A, P(x) is true.' is 'There is an x in A such that P(x) is false."

Such That
As we have seen, such that can be used in at least two cases: in conjunction with there exists and in picking out elements of a set. Of course, if you think about it, these two are really the same application because the statement "there exists" gives you the set of all things that exist, and the such that statement decreases the size of that set to focus just on the things in which you are interested. Such that is normally denoted as a colon or as a vertical bar (|), and sometimes as "s.t."

Without Loss of Generality
This is a very helpful phrase in making proofs more concise and less redundant. For example, assume we have two integers x and y and that we know one of them is odd and one of them is even. Instead of trying to do two different parallel proofs, one where we assume that x is even and y is odd and another where we assume that y is even and x is odd, we simply say "Without loss of generality, assume x is even." Then we continue with the proof. This is done since the exact same argument applies if y actually was the even number, all we have to do is relabel x and y.

The Universe
Now, we're not going to begin a discussion of astronomy. In mathematics, the universe is overall, the biggest set that your discussion is referring to. For example, if the universe is not restricted, then the set of all things would truly be the set containing every single thing. However, if your universe is the set of all things on Earth, then the "set of all things" would not include Jupiter, since Jupiter is not on Earth.

Difference
In arithmetic, difference means the distance between two numbers—how far apart they are on the number line. In set theory, difference means something slightly different, but the same notation is used. ($$A-B$$ denotes the difference of A and B.) The difference is the set of all things that are in A that are not in B. $$A-B = \{x\in A|x\notin B\}=\{x|x\in A\land x\notin B\}$$ In normal English, we use this concept when we say things like "Everyone with no demerits gets an A in this course."

Complement
The complement of a set contains everything that is not in the original set. This definition only makes sense when a universe is understood. The complement is usually denoted by $$A^c$$. If U is the universe, then the complement of A is defined to be $$ A^c = U - A$$.

The diagram to the right is a Venn diagram. A Venn diagram shows the relationships of sets. Note that in the figure, U is the universe, and A and B are sets in U. The blue portion is the complement of $$A\cup B$$. This is a general drawing, since it is not known whether there are elements in A and B. If $$A\cap B$$ is known to be empty, then they may be drawn disjoint.

The complement of a set is essentially the same as the negation of a statement. That is, if $$ A = \{x|P(x)\}$$, then $$A^c = \{x|\lnot P(x)\}$$. Thus, complements are used when saying what something is not.

Exercises

 * 1) Express the following statements in terms of sets, using difference or complement.
 * 2) All people that have two legs.
 * 3) All mythological creatures that are not Greek.
 * 4) All pudding pies that have no cream on top.
 * 5) Draw a Venn Diagram to illustrate the following.
 * 6) $$A\cap B\cap C$$
 * 7) $$A\cup B - C$$
 * 8) $$(A^c\cap B^c)\cup C$$
 * 9) $$A\cap(B\cup C)$$
 * 10) $$A- (U-B)$$
 * 11) Negate the following statements.
 * 12) $$\forall x\in A, \exists y\in B: P(x,y)$$
 * 13) All quick, brown foxes jump over some lazy dog.


text:
Rosacea/Researching

There are many places to find information on Internet, but most people do not know where and how to access them. Large amounts of information are not even available on the Internet such as books and specialised medical journal articles. Search engines such as Google or Yahoo! are the main way to search for information but still many sites are only partly indexed and many database repositories are not even indexed by search engines.

The first thing anyone with rosacea is spend a few hours reading various resources, this will give you a basic knowledge of the disorder and what treatments are available. A list of general information websites follows:
 * Australian Sciences - Free Rosacea Booklet, explains heat regulation and flushing in rosacea. (http://www.ausci.com/rosacea.htm)
 * DermIS - Information in Français, Portugues, Español, English and Deutsch. (http://dermis.multimedica.de/)
 * DermnetNZ - Has a page of rosacea information that is up to date and with photos. (http://www.dermnetnz.org/)
 * Dr. Geoffrey Nase, PhD - Rosacea Specialist details rosacea causes, rosacea treatments, rosacea FAQs, and lots more information. (http://drnase.com/)
 * National Rosacea Society - lots of basic information for patients and physicians. (http://www.rosacea.org/)
 * Rosacea Support - Rosacea FAQ and the list highlights. (http://rosacea.ii.net/)
 * Rosaceans - Lots of links and some information on alternative treatments. Also see the rosacea 101. (http://www.rosaceans.com/)
 * Wikipedia - Basic rosacea info with hyperlinks to much more reference information. (http://en.wikipedia.org/wiki/Rosacea)

People not familiar with search engines should refer to the reference book How To Search for particular information about each search engine. In 2005 The Rosacea Search Engine (http://rosacea-archive.com/search.php) was set up to search only rosacea related websites. It is considered the most in depth search engine for rosacea. Other search engines such as Google or Yahoo! Index more sites and are also useful for boarder searches especially for searches not directly related to rosacea.

Books
You are unlikely to find anything about rosacea in your local library, but there are a few books that can be ordered over the Internet. Althrough you probably won't find a copy at your library it is probably a good option to check anyway to save yourself a bit of money. Most books will be of a high quality but they do date and you have to make sure you fit the targeted audience otherwise you will find yourself over your head with medical jargon. A list of rosacea books follow, if they can be ordered from the authors website than the website will be listed otherwise you will have to find a bookstore to order the book from such as amazon (http://www.amazon.com/):
 * Ann-Marie Lindstrom, L. E. Mills - "The Rosacea Handbook: A Self-Help Guide".
 * Dr. Geoffrey Nase, PhD - "Beating Rosacea - vascular, ocular and acne forms". (http://drnase.com/)
 * Gerd Plewig, Albert M. Kligman - "Acne and Rosacea".
 * Icon Health Publications - "Rosacea - A Medical Dictionary, Bibliography, and Annotated Research Guide to Internet References".
 * James N. Parker, Philip M. Parker - "The Official Patient's Sourcebook on Acne Rosacea".
 * PM Medical Health News - "21st Century Complete Medical Guide to Rosacea and Related Disorders, Authoritative Government Documents, Clinical References, and Practical Information for Patients and Physicians (CD-ROM)".
 * Brady Barrows - "Rosacea 101: Includes the Rosacea Diet". (http://www.rosacea-101.com)
 * Brady Barrows - "Rosacea Diet - A Simple Method to Control Rosacea Vegetarian and Omnivore Friendly". (http://www.rosacea-diet.com/html/diet.html)
 * Rosacea Support - Book reviews by David Pascoe (http://rosacea.ii.net/reviews.html)
 * Arlen Brownstein, M.S., N.D., Donna Shoemaker, C.N. - "Rosacea - Your self help guide". (http://www.rosaceaworld.com/)

title: Rosacea/Researching