text:
X86 Disassembly/Loops

Loops
To complete repetitive tasks, programmers often implement loops. There are many sorts of loops, but they can all be boiled down to a few similar formats in assembly code. This chapter will discuss loops, how to identify them, and how to "decompile" them back into high-level representations.

Do-While Loops
It seems counterintuitive that this section will consider Do-While loops first, considering that they might be the least used of all the variations in practice. However, there is method to our madness, so read on.

Consider the following generic Do-While loop:

What does this loop do? The loop body simply executes, the condition is tested at the end of the loop, and the loop jumps back to the beginning of the loop if the condition is satisfied. Unlike if statements, Do-While conditions are not reversed.

Let us now take a look at the following C code:

Which can be translated into assembly language as such:

While Loops
While loops look almost as simple as a Do-While loop, but in reality they aren't as simple at all. Let's examine a generic while-loop:

What does this loop do? First, the loop checks to make sure that x is true. If x is not true, the loop is skipped. The loop body is then executed, followed by another check: is x still true? If x is still true, execution jumps back to the top of the loop, and execution continues. Keep in mind that there needs to be a jump at the bottom of the loop (to get back up to the top), but it makes no sense to jump back to the top, retest the conditional, and then jump back to the bottom of the loop if the conditional is found to be false. The while-loop then, performs the following steps:

 * 1) check the condition. if it is false, go to the end
 * 2) perform the loop body
 * 3) check the condition, if it is true, jump to 2.
 * 4) if the condition is not true, fall-through the end of the loop.

Here is a while-loop in C code:

And here then is that same loop translated into assembly:

If we were to translate that assembly code back into C, we would get the following code:

See why we covered the Do-While loop first? Because the While-loop becomes a Do-While when it gets assembled.

So why can't the jump label occur before the test?

For Loops
What is a For-Loop? In essence, it's a While-Loop with an initial state, a condition, and an iterative instruction. For instance, the following generic For-Loop:

gets translated into the following pseudocode while-loop:

Which in turn gets translated into the following Do-While Loop:

Note that often in for loops you assign an initial constant value in A (for example x = 0), and then compare that value with another constant in B (for example x < 10). Most optimizing compilers will be able to notice that the first time x IS less than 10, and therefore there is no need for the initial if(B) statement. In such cases, the compiler will simply generate the following sequence:

rendering the code indistinguishable from a while loop.

Other Loop Types
C only has Do-While, While, and For Loops, but some other languages may very well implement their own types. Also, a good C-Programmer could easily "home brew" a new type of loop using a series of good macros, so they bear some consideration:

Do-Until Loop
A common Do-Until Loop will take the following form:

which essentially becomes the following Do-While loop:

Until Loop
Like the Do-Until loop, the standard Until-Loop looks like the following:

which (likewise) gets translated to the following While-Loop:

Do-Forever Loop
A Do-Forever loop is simply an unqualified loop with a condition that is always true. For instance, the following pseudo-code:

will become the following while-loop:

Which can actually be reduced to a simple unconditional jump statement:

Notice that some non-optimizing compilers will produce nonsensical code for this:

Notice that a lot of the comparisons here are not needed since the condition is a constant. Most compilers will optimize cases like this.

title: X86 Disassembly/Loops


text:
X86 Disassembly/Code Obfuscation

Code Obfuscation
Code Obfuscation is the act of making the assembly code or machine code of a program more difficult to disassemble or decompile. The term "obfuscation" is typically used to suggest a deliberate attempt to add difficulty, but many other practices will cause code to be obfuscated without that being the intention. Software vendors may attempt to obfuscate or even encrypt code to prevent reverse engineering efforts. There are many different types of obfuscations. Notice that many code optimizations (discussed in the previous chapter) have the side-effect of making code more difficult to read, and therefore optimizations act as obfuscations.

What is Code Obfuscation?
There are many things that obfuscation could be:

 * Encrypted code that is decrypted prior to runtime.
 * Compressed code that is decompressed prior to runtime.
 * Executables that contain Encrypted sections, and a simple decrypter.
 * Code instructions that are put in a hard-to read order.
 * Code instructions which are used in a non-obvious way.

This chapter will try to examine some common methods of obfuscating code, but will not necessarily delve into methods to break the obfuscation.

Interleaving
Optimizing Compilers will engage in a process called interleaving to try and maximize parallelism in pipelined processors. This technique is based on two premises:

 * 1) That certain instructions can be executed out of order and still maintain the correct output
 * 2) That processors can perform certain pairs of tasks simultaneously.

x86 NetBurst Architecture
The Intel NetBurst Architecture divides an x86 processor into 2 distinct parts: the supporting hardware, and the primitive core processor. The primitive core of a processor contains the ability to perform some calculations blindingly fast, but not the instructions that you or I am familiar with. The processor first converts the code instructions into a form called "micro-ops" that are then handled by the primitive core processor.

The processor can also be broken down into 4 components, or modules, each of which is capable of performing certain tasks. Since each module can operate separately, up to 4 separate tasks can be handled simultaneously by the processor core, so long as those tasks can be performed by each of the 4 modules:

 * Port0 : Double-speed integer arithmetic, floating point load, memory store

 * Port1 : Double-speed integer arithmetic, floating point arithmetic

 * Port2 : memory read

 * Port3 : memory write (writes to address bus)

So for instance, the processor can simultaneously perform 2 integer arithmetic instructions in both Port0 and Port1, so a compiler will frequently go to great lengths to put arithmetic instructions close to each other. If the timing is just right, up to 4 arithmetic instructions can be executed in a single instruction period.

Notice however that writing to memory is particularly slow (requiring the address to be sent by Port3, and the data itself to be written by Port0). Floating point numbers need to be loaded to the FPU before they can be operated on, so a floating point load and a floating point arithmetic instruction cannot operate on a single value in a single instruction cycle. Therefore, it is not uncommon to see floating point values loaded, integer values be manipulated, and then the floating point value be operated on.

Non-Intuitive Instructions
Optimizing compilers frequently will use instructions that are not intuitive. Some instructions can perform tasks for which they were not designed, typically as a helpful side effect. Sometimes, one instruction can perform a task more quickly than other specialized instructions can.

The only way to know that one instruction is faster than another is to consult the processor documentation. However, knowing some of the most common substitutions is very useful to the reverser.

Here are some examples. The code in the first box operates more quickly than the one in the second, but performs exactly the same tasks.

Example 1

Fast

Slow

Example 2

Fast

Slow

Sometimes such transformations could be made to make the analysis more difficult:

Example 3

Fast

Slow

Example 4

Fast

Slow

Common Instruction Substitutions

 * lea : The lea instruction has the following form:

Where XS is a segment register (SS, DS, CS, etc...), reg1 is the base address, reg2 is a variable offset, and x is a multiplicative scaling factor. What lea does, essentially, is load the memory address being pointed to in the second argument, into the first argument. Look at the following example:

Now, what is the value of ecx? The answer is that ecx has the value of (eax + 4), which is 5. In essence, lea is used to do addition and multiplication of a register and a constant that is a byte or less (-128 to +127).

Now, consider:

Now, ecx equals 3.

The difference is that lea is quick (because it only adds a register and a small constant), whereas the add and mul instructions are more versatile, but slower. lea is used for arithmetic in this fashion very frequently, even when compilers are not actively optimizing the code.

 * xor : The xor instruction performs the bit-wise exclusive-or operation on two operands. Consider then, the following example:

What does this do? Let's take a look at the binary:

10101010 ;10101010 = 0xAA xor 10101010 00000000

The answer is that "xor reg, reg" sets the register to 0. More importantly, however, is that "xor eax, eax" sets eax to 0 faster (and the generated code instruction is smaller) than an equivalent "mov eax, 0".

 * mov edi, edi : On a 64-bit x86 system, this instruction clears the high 32-bits of the rdi register.

 * shl, shr : left-shifting, in binary arithmetic, is equivalent to multiplying the operand by 2. Right-shifting is also equivalent to integer division by 2, although the lowest bit is dropped. in general, left-shifting by $$N$$ spaces multiplies the operand by $$2^N$$, and right shifting by $$N$$ spaces is the same as dividing by $$2^N$$. One important fact is that resulting number is an integer with no fractional part present. For example:

 * xchg : xchg exchanges the contents of two registers, or a register and a memory address. A noteworthy point is the fact that xchg operates faster than a move instruction. For this reason, xchg will be used to move a value from a source to a destination, when the value in the source no longer needs to be saved.

As an example, consider this code:

Here, the value in  is stored in , and then   is loaded with the value zero. We can perform the same operation, but using  and   instead:

It may surprise you to learn that the second code example operates significantly faster than the first one does.

Obfuscators
There are a number of tools on the market that will automate the process of code obfuscation. These products will use a number of transformations to turn a code snippet into a less-readable form, although it will not affect the program flow itself (although the transformations may increase code size or execution time).

Code Transformations
Code transformations are a way of reordering code so that it performs exactly the same task but becomes more difficult to trace and disassemble. We can best demonstrate this technique by example. Let's say that we have 2 functions, FunctionA and FunctionB. Both of these two functions are comprised of 3 separate parts, which are performed in order. We can break this down as such:

And we have our main program, that executes the two functions:

Now, we can rearrange these snippets to a form that is much more complicated (in assembly):

As you can see, this is much harder to read, although it perfectly preserves the program flow of the original code. This code is much harder for a human to read, although it isn't hard at all for an automatic disassembler (such as IDA Pro) to read.

Opaque Predicates
An Opaque Predicate is a predicate inside the code, that cannot be evaluated during static analysis. This forces the attacker to perform a dynamic analysis to understand the result of the line. Typically this is related to a branch instruction that is used to prevent in static analysis the understanding which code path is taken.

Code Encryption
Code can be encrypted, just like any other type of data, except that code can also work to encrypt and decrypt itself. Encrypted programs cannot be directly disassembled. However, such a program can also not be run directly because the encrypted opcodes cannot be interpreted properly by the CPU. For this reason, an encrypted program must contain some sort of method for decrypting itself prior to operation.

The most basic method is to include a small stub program that decrypts the remainder of the executable, and then passes control to the decrypted routines.

Disassembling Encrypted Code
To disassemble an encrypted executable, you must first determine how the code is being decrypted. Code can be decrypted in one of two primary ways:
 * 1) All at once. The entire code portion is decrypted in a single pass, and left decrypted during execution. Using a debugger, allow the decryption routine to run completely, and then dump the decrypted code into a file for further analysis.
 * 2) By Block. The code is encrypted in separate blocks, where each block may have a separate encryption key. Blocks may be decrypted before use, and re-encrypted again after use. Using a debugger, you can attempt to capture all the decryption keys and then use those keys to decrypt the entire program at once later, or you can wait for the blocks to be decrypted, and then dump the blocks individually to a separate file for analysis.

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

title: X86 Disassembly/Code Obfuscation


text:
Ada Programming/Pragmas/Suppress

Summary
The pragma Suppress suppresses compiler-generated run-time checks. If a run-time check is disabled, an exception may be suppressed and undefined behavior could result. pragma Suppress is used at the programmer's risk.

Checks that may be suppressed are:

 * Access_Check - Check for dereference of a null access value. Constraint_Error suppressed.
 * Accessibility_Check - Check for access of inaccessible object or subprogram. Program_Error suppressed.
 * Discriminant_Check - Check for access of an unavailable component in a discriminant record (given the discriminant). Constraint_Error suppressed.
 * Division_Check - Checks for divide by zero. Constraint_Error suppressed.
 * Elaboration_Check - Checks for unelaborated package or subprogram body. Program_Error suppressed.
 * Index_Check - Check for out-of-range array index. Constraint_Error suppressed.
 * Length_Check - Check for array length violation. Constraint_Error suppressed.
 * Overflow_Check - Check for numeric overflow. Constraint_Error suppressed.
 * Range_Check - Check of scalar variable for out-of-range values. Constraint_Error suppressed.
 * Storage_Check - Check for sufficient storage space to accommodate subprogram call. Storage_Error suppressed.
 * Tag_Check - Checks for invalid object tag. Constraint_Error suppressed.
 * All_Checks - All the above checks

Example
My_Array : Array ( 1 .. 100 ) of Integer; ( Index_Check ); ... Some_Variable := My_Array( 1000 );

Wikibook

 * Ada Programming/Pragmas/Unsuppress

Ada Quality and Style Guide

|Suppress

title: Ada Programming/Pragmas/Suppress


text:
Cookbook:Milk Toast I

Milk toast is a breakfast food consisting of toasted bread dipped in milk. Milk toast was a popular food throughout the late 19th century and early 20th century, especially for young children and for the ailing, for whom the food was thought to be soothing and easy to digest. Although not as popular today, milk toast is still considered a comfort food.

This recipe, though of common domain, is provided in the food writer M.F.K. Fisher's book An Alphabet for Gourmets under the title MILK TOAST for the Ill, Weak, Old, Very Young, or Weary.

Ingredients

 * 1 pint (570 ml) milk, part cream if the person is not forbidden that
 * 4 slices good bread, freshly toasted
 * Sweet butter, if allowed
 * Salt
 * Pepper

Procedure

 * 1) Heat the milk to the simmering point.
 * 2) Generously butter the toast slices.
 * 3) Heat a pretty bowl, deeper than it is wide. Break the hot buttered toast into it, pour the steaming but not boiling milk over it, sprinkle a little salt and pepper on the top, and serve at once.

Notes, tips, and variations

 * Although the recipe calls for salt, milk toast may also be made sweet by the omission of salt and pepper and the addition, instead, of sugar. Other optional ingredients for sweet versions include cinnamon, honey or a touch of vanilla, but piquant and exotic ingredients should be avoided, as the primary purpose of milk toast is to provide a food soothing to the palate and to the digestion.

title: Cookbook:Milk Toast I


text:
Reverse Engineering/Mac OS X

Apple Computer's Mac OS X is the standard Operating System used on Apple Macintosh computers. Other operating systems, primarily Linux, have been ported onto Mac Hardware, and there has been some effort to port OS X onto non-Mac Intel-based hardware, but neither of these efforts has attained the kind of popularity that the "standard bundle" has attained.

Mac OS X has been critically acclaimed by many people in the computer world as being both beautiful and easy to use. OS X is built on a BSD and Mach core but has a certain amount of software that is Mac-specific.

Try hard to keep this on the subject of general reverse engineering for Mac OS X, and not on 'cracking', or reversing only for security purposes. I have created special sections for these subjects, and all material focused on them should be kept there. Thanks! --Macpunk 04:17, 9 July 2007 (UTC)

Hardware Architecture
Historically before OS X Macs ran the Mac OS operating system on the Motorola 68000 through the 68040 and PowerPC architectures. Steve Jobs would later leave Apple to create NeXT. After Apple had completed its hardware migration to the PowerPC platform it looked to a new kernel that could take advantage of this new hardware architecture. Many projects were started and failed and this and other factors led to the decline of Apple. In a move to capitalize on the new architecture it turned to [http://en.wikipedia.org/wiki/Be_Inc. Be Inc.] to purchase its new BeOS, this would later fall through as Be Inc. wanted too much money. Apple then turned to NeXT and acquired not only the NeXT OS but Steve Jobs. Steve Jobs quickly took control of Apple and placed the NeXT architecture as the replacement for Apple's aging Mac OS. The replacement product was originally known as Rhapsody which had the older Mac OS feel to it. Steve Jobs felt the interface did not do it justice so his team of ex-NeXT engineers developed Aqua and Mac OS X was born.

Mac OS X 10.0 "Cheetah" through 10.4.3 "Tiger" would only run on the 4th and 5th generation of the PowerPC architecture. It became clear to Apple that IBM was having trouble with the 5th generation of the PowerPC known as the PowerPC G5 both in Development and Manufacturing. In addition IBM had yet to release a laptop version of the G5 process a year after it promised Apple it would. Apple then decided to migrate away from the PowerPC architecture and to an Intel based one. Apple chose the Intel 32-bit Core Duo architecture. Apple's second generation of Intel products appeared less than a year later running the Intel 64-bit Core 2 Duo architecture.

Apple originally included a Trusted Platform Module (TPM) to help curb pirating of Mac OS X. Later, Apple would turn to a simple AES encryption system where the encryption keys were stored in a kernel device driver. This led to the ability to decrypt and even encrypt Mac OS X executable binary files. The new TPM system is no longer present in any modern Mac. The new encryption system is only available to the Intel based Macs and yields all sorts of errors if attempted on the PowerPC platform.

Apple has committed to supporting both PowerPC and Intel platforms for the next few years. Every Mac OS X system today ships with its binary files in a Universal binary format which can be ran in both PowerPC and Intel based Macs. The Universal binary is simply the source files compiled multiple times, (once for each architecture), and then glued together afterwards. When the OS reads this universal binary it will then select the proper version of that compiled code and execute it. Since not all binary files are Universal, Apple released for the Intel platforms a software component called Rosetta which would dynamically translate PowerPC system calls to Intel system calls allowing the PowerPC binary to be executed on an Intel Mac.

Software Architecture
All builds of Mac OS X (OS X) are built on top of an XNU kernel and Mach-O file format. The XNU kernel is a Hybrid kernel. The kernel is divided into 4 sections.

Kernel Sections

 * 1) The Hardware Platform Expert
 * 2) The Mach 3.0 Subsystem (OSFMK)
 * 3) The BSD 4.4 Subsystem
 * 4) The IOKit Subsystem and Framework

While the traditional Mach kernel is a Microkernel, Apple has instead implemented its variation of Mach 3.0 with a Monolithic design. The Mach subsystem is only a partial implementation of the Mach 3.0 kernel that was designed by Carnegie Mellon University. This partial implementation consists of the Mach Messaging system, Mach Virtual Memory System and Mach Process Manager.

The BSD 4.4 Subsystem is a micro implementation of the FreeBSD 4.x kernel. Over time Apple has been shrinking and reducing the feature set of this kernel subsystem in the hope to eliminate all but the essential pieces to run BSD source code software on the XNU kernel. Originally the subsystem had support for BSD device drivers, which could communicate directly to hardware. Unfortunately the device driver architecture in the BSD Subsystem is only able to support direct main memory access and to interface into the UserMode part of a running process.

The IOKit Framework is a subset of the C++ programming language known as Embedded C++. The IOKit Subsystem drives the components written in the IOKit Framework. IOKit's purpose is to unify and simplify the Driver architecture while maintaining some level of compatibility between major and minor OS releases. IOKit has generally been a resounding success as some other BSD operating systems have ported or implemented an IOKit like system to it, (such as DragonFly BSD).

The Hardware Platform Expert deals with the hardware differences of the PowerPC (G3, G4 and G5), Intel 32-bit, Intel 64-bit, Intel Xeon 64-bit (Mac Pro and XServe) and ARM (iPhone) architectures.

Commonly Used Tools
The common tools used to both compile/create the software and to disassemble/debug the software has been titled by Apple as the "Developer Tools". The developer tools can be found both on the Installation DVD for Mac OS X 10.4 and higher as well as the Apple Developer Connection (ADC) site. Joining ADC is free and is highly recommended. The ADC site has up to date documentation, tools and even sample source code. The ADC site should be your 1st place to do you research. A summary of the developer tools can be found at Apple's official XCode And Tools website. The tools commonly used on the Mac OS X platform for reverse engineering besides the developer documents are found in the list below.

Developer Tools Used

 * 1) gdb (GNU Debugger)
 * 2) nm (Object File Symbol Table Viewer)
 * 3) otool (Object File Display Tool)
 * 4) fs_usage (File System Monitoring Tool)
 * 5) lsof (File Descriptor Table Viewer)
 * 6) vmmap (Virtual Memory Regions Viewer)
 * 7) lipo (Universal Binary Handler)
 * 8) file (Binary File Format Analyzer)

All of the above tools are installed during the Developer Tools Installation. As of current writing (3 Aug 2008) the current Developer Tools version is 3.1 (Build 2199).

Third party tools:
 * 1)  class-dump is useful for parsing Objective-C runtime information.

Architecture
Since most target binaries that you wish to reverse engineer on the Mac OS X platform are in the Mach-O Universal Binary format you should decide which target binary platform you wish to reverse engineer. To get a list of what formats a specific binary has you would call the "file" program. Example:

A common example using the file "/bin/ls": $ file /bin/ls /bin/ls: Mach-O universal binary with 2 architectures /bin/ls (for architecture i386):	Mach-O executable i386 /bin/ls (for architecture ppc7400):	Mach-O executable ppc

Another example, this time more of a rare one, using the file "/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices" $ file /System/Library/Frameworks/ApplicationServices.framework/ApplicationServices /System/Library/Frameworks/ApplicationServices.framework/ApplicationServices: Mach-O universal binary with 4 architectures /System/Library/Frameworks/ApplicationServices.framework/ApplicationServices (for architecture ppc7400):	Mach-O dynamically linked shared library ppc /System/Library/Frameworks/ApplicationServices.framework/ApplicationServices (for architecture ppc64):	       Mach-O 64-bit dynamically linked shared library ppc64 /System/Library/Frameworks/ApplicationServices.framework/ApplicationServices (for architecture i386):	       Mach-O dynamically linked shared library i386 /System/Library/Frameworks/ApplicationServices.framework/ApplicationServices (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64

Symbols
Once you have identified the architecture you wish to use as your base for reverse engineering you would then dump the symbol table. This can be handy for the future. Example:

Common symbol table dump from the i386 architecture: $ nm -arch i386 /bin/echo U ___error 00001000 A __mh_execute_header U _exit U _malloc U _strerror$UNIX2003 U _strlen U _write$UNIX2003 U _writev$UNIX2003

The above symbols can be broken up into 2 major categories:

Symbol Types

 * 1) External
 * 2) Internal

There is a 3rd category of symbols which are called "hidden" or "stripped" symbols. These symbols do not show up on nm and are hard to find out what they are doing and if they exist at all.

Each symbol type has a scope. The scope can either be private or public. In the past you could set the dynamic linker to a "flat namespace" which would convert the private symbols to public for your program only, however it has been reported that this functionality has been disabled on most libraries.

A private symbol is a symbol that is addressable by either the entire program or a section of the program only and can not be addressed by anyone else. A public symbol is one that is commonly known on other platforms as "Exported". The public symbols can be accessed by anything that links to that binary either at compile time or runtime.

Internal Symbols
Internal symbols are symbols that are defined within the program and thus are not imported, (dynamically linked), during runtime. An internal symbol can however be an external symbol that was linked in at compile time and the source of that symbol was an object file or a static library. You can identify an internal symbol quickly because the line with the symbol has a hexadecimal number before the symbol type letter. External symbols have a blank space where the number should be. The number specified in the symbol table denotes at what offset in the file that symbol's code or data starts at. This value is relative and WILL be different at runtime. One way a symbol is located in memory during runtime is to find the relative positions of 2 symbols on the disk, 1st being a well known symbol and the 2nd being an unknown one, then extract the difference. Once you have the difference you can find the 2nd symbol in memory by simply apply the difference to the 1st symbols address. Example:

Example
Find the 1st and 2nd symbols: $ nm /System/Library/Frameworks/QTKit.framework/QTKit /System/Library/Frameworks/QTKit.framework/QTKit(single module): {...}   0005a638 T _copyBitmapRepToGWorld 0008b017 t _createDisplayList {...}

In the above example our 1st symbol is "_copyBitmapRepToGWorld" which in a program is known as "copyBitmapRepToGWorld". Our 2nd symbol is "_createDisplayList" which in a program is unknown since its a private symbol, (See private symbols). Once the function definition for the symbol "_createDisplayList" can be determined then it becomes important to define that symbol for your program's use. To do this lets assume that "_createDisplayList" C function prototype would be:

void * createDisplayList(void);

The above prototype would be defined in the source code for the QTKit which is our target. That unfortunately doesn't help us since both the function prototype and the symbol name is unknown to our program. To resolve this problem we simple compute the difference from the above symbols, (the difference is 0x309DF), and define our function prototype as this:

void * (* createDisplayList)(void);

Then you would assign that function its address by having another function, (such as main), execute this command before you use that function for the 1st time:

createDisplayList = copyBitmapRepToGWorld + 0x309DF;

Some programs can get away with doing the above in 1 command outside of a function, I would NOT recommend this as the Mac OS X dynamic linker dyld sometimes will change the value of the symbol address before you enter your main function but after the variable's initial values have been defined.

External Symbols
External symbols are symbols that are defined elsewhere like in a library, (see library below). To read an external symbol you simply strip the leading "_" off. If the symbol has a "$" in its name then everything past the 1st "$" is a hint to the dynamic linker that this symbol is an explicate external symbol and should be matched with that exact version of the symbol in the external library. An explicit symbol is very helpful for a program creator since it allows him/her to make it difficult to override the symbol or to have a runtime link mismatch error. The letter to the left of the symbol name, (in the above example "U"), denotes the type of symbol such as function or data structure.

PowerPC
Basic instructions include li (load immediate) and mr (move register).

The Stack
The PowerPC stack works exactly as any other stack would. It's a LIFO structure, and it grows downwards(towards lower memory addresses). The most important detail to remember when reversing PowerPC binaries is that the PowerPC chip has no built in implementation of a stack. There's no register designated to keep track of where the bottom of the stack is, and there's no instructions to push and pop data off of the stack. Everything is done via a general purpose register, and various arithmetic instructions.

(This section will contain PowerPC specific information like how PowerPC function calls are executed, how arguments are passed to functions, the stack format, et cetera.)--Macpunk 06:19, 8 July 2007 (UTC)

Intel
(This section will contain Intel specific information like how Intel function calls are executed, how arguments are passed to functions, the stack format, et cetera.)--Macpunk 06:19, 8 July 2007 (UTC)

Special Notes
A large section of this document has been prepared and written by JosephC7, while this information has been granted for use by Wikibooks for free publication it should be noted that the author only asks that if you republish this information that you provide the author's user name and link to his user page on wikibooks.org. No fees is required or requested for this information and it is expected that if this information is republished that it too be given away freely with out compensation. This document is a work in progress and should be completed by the end of Aug 2008.

title: Reverse Engineering/Mac OS X


text:
Ada Programming/Pragmas/Inline

Summary
The pragma Inline specifies that a subprogram should be expanded inline when called in code.

Example
My_Function Integer 1+2;  My_Function; (My_Function); ... Some_Variable := My_Function;

Wikibook

 * Ada Programming
 * Ada Programming/Pragmas

|Inline

title: Ada Programming/Pragmas/Inline


text:
Ada Programming/Pragmas/Import

Summary
The pragma Import directs the compiler to use code or data objects written in a foreign computer language.

Which foreign languages are supported depends on the compiler implementation. Typically C, C++, Cobol, and Fortran are supported.

Example
my_C_function { 1; }

My_C_Function Integer; (Convention   => C,    Entity        => My_C_Function,    External_Name => "my_C_function" ); ... Some_Variable := My_C_Function;

Wikibook

 * Ada Programming
 * Ada Programming/Pragmas
 * Ada Programming/Pragmas/Export
 * Ada Programming/Pragmas/Convention
 * Ada Programming/Pragmas/Linker_Options
 * Ada Programming/Pragmas/Interface (obsolescent)

|Import Import Import

title: Ada Programming/Pragmas/Import


text:
Ada Programming/Pragmas/Export

Summary
The pragma Export directs the compiler to make available subprograms or data objects written in Ada to foreign computer languages. If a subprogram is exported, it is compiled with conventions expected by the foreign language. For example, if a subprogram is being exported to C, record types declared in the subprogram are compiled the same as C-style structs.

The set of supported foreign languages depends on the compiler implementation. Typically C, C++, Cobol, and Fortran are supported.

Example
main { My_Int; adainit; My_Int = My_Ada_Function; adafinal; 0; }

My_Ada_Function Integer 1; My_Ada_Function; (Convention   => C,  Entity        => My_Ada_Function,  External_Name => "My_Ada_Function" );

Wikibook

 * Ada Programming
 * Ada Programming/Pragmas
 * Ada Programming/Pragmas/Import
 * Ada Programming/Pragmas/Convention
 * Ada Programming/Pragmas/Linker_Options
 * Ada Programming/Pragmas/External (implementation defined)

|Export Export Export

title: Ada Programming/Pragmas/Export


text:
Talk:Marksmanship

It seems a bit unfortunate that a wikipage on sport shooting leads to a section on military use of firearms.

readers looking to learn about target sport marksmanship could be misled into thinking that the shooting sports are only about learning to kill.

Marksmanship - Military or Civilian the Theory's the Same.
Thats a very general statement to make, The majority of people looking up the priciples of Marksmanship would be military people. A lot of the Theory of Small arms Fire was developed by the Military and is mredundant to The Sports Target Shooter, You must remember that the Majority of Shooting done by the Military (well, outside the US Military anyway) is at 4' Targets (Speaking from Personal experience and I am a qualified Military Marksman)

This Article is a General one on Marksmanship, and as its in its Infancy its better to keep the Terms General rather than start a thread on Target Marksmanship, Hunting Marksmanship, or Military Marksmanship.

Regards.

Integrating military and general marksmanship
I have inserted a section called Fundamentals of Rifle Marksmanship' even though they duplicate some of the original entry from the US Army manual. I am leaving the duplicate sections for the moment, pending a Wikipedia editor's evaluation. As a competition shooter of nearly 30 years experience (I've led a national championship team), I believe there is no difference between military and civilian techniques: shooters use whatever works best for them, and overlap is unavoidable.

Similar sections should be inserted that specifically address handgun and shotgun marksmanship. I feel qualified to comment upon on the former, less so on the latter.

There could also be a section briefly describing the various types of marksmanship events (bullseye, silhouette, action shooting, etc) but that decision should be left to our long-suffering editors.

68.2.139.236 23:25, 25 April 2006 (UTC)

I agree with the opening statement at the top 100% and it angers me that a book titled "Marksmanship" includes facsimiles of the human form as targets. Incuding being exceedingly distasteful, there are ethical, psychological and legal issues that make the use of the human form as a shooting target dangerous. To begin with those who oppose the non-military/non-police use of firearms can use this book as an argument against those who legally use firearms for other purposes therefore supporting their arguments. I am suspicious of the person who has published these targets in this book for that reason and the others you will find below. The purpose of using the human form as a target is to desensitize people to make it easier for them to shoot and possibly kill other humans. I have no intention of ever killing another human, so do not even like seeing a target of the human form. There have been court cases and legal precedents regarding practising shooting on targets representing the human form where premeditation of murder was proven based on this. A case could be make of premeditated murder or attempted murder if there was say, a shooting accident and the defendant had at some time practised shooting at a human form target. I once had a police officer attempt to gift me some human silhouette targets. He had a reputation of being shady. I would like the original contributor to remove the human silhouette targets from the book and replace them with types of targets that were more traditionally used by marksmen or to use more inclusive terminology "sharpshooters". Annie Oakley was definitely a fantastic shot as well as currently Dr. Susan Nattrass, to mention two shooters who are not "men".

Integerating Civlian and Military marksmanship

 * First off I am the orignal "author" (i.e. I started this wikibook).
 * I am ex military and ex sport shooter (the law changes here in Australian sort of ruined my enjoyment and the practicality of sport shooting here, for me)
 * I agree that the underlying of civil and military marksmanship are the same, e.g. position and hold, sight alignment, trigger manipulation etc.
 * However I disagree with the sentiment that "readers looking to learn about target sport marksmanship could be misled into thinking that the shooting sports are only about learning to kill."
 * First off marksmanship does not only mean target sports marksman ship. It is equally applicable to shooting in the sport of hunting, shooting in the recreation of plinking, but also shooting in the context of military or law enforcement.
 * An article about marksmanship generally (which is what this is hence the title "Marksmanship" as opposed to for example "Miliatary Marksmanship" or "Civilian Marksmanship" or "Marksmanship for the shooter" ) should cover all types of marksmanship, not just sports shooting, and if I recall corretly my oroginal contributions did not present any difference between different calsses of marksmanship. other than perhaps to include terms which are more widely used in a military context (which is not to say that they are not used or have no application in a civillian context, "first catch", "first graze" are example.
 * I am happy for people to replace diagrams which contain shaped or abstract human shapes with other shaped targets, however it strikes me as being a biut rude and a bit unreasonable to take them down and not replace them, as regardless of the shape of the targets, the content is relevant to a discussion of marksmanship overall.
 * It should be born in mind that targets shaped as animals e.g. for metalic silhouette - night also be offensive or distasteful some people.
 * I don't believe that just because something might be distasteful or even IS distasteful or ethically difficult for some people that it should not be included. There are lots of articles in wikipedia and probably lots of wikibooks that cover topics that are distasteful or ethically challenging for some people, for example religious topics. That is not reason to exclude them and I don;t think that because some individuals find the use of human or abstract human targets distasteful that they should be excluded.
 * This is not an article on ethics or morality it is an article on marksmanship. IF you want to discuss the ethics or morals of shooting firearms, then a more appropriate place might be a book on that topic. This is a book on the practical and theoretical aspects of marksmanship
 * I think that reference to particular disciplines in sport, civil or military shooting, e.g discussion of ISPC rules (which by the way is - or was -a civilian "target sport" which does use abstract human forms as targets, e.g. pepper poppers)) is probably out of place in a book about marksmanship, other than as asides and examples for comparative purposes.
 * I think if you want an article specifically on "sport target" shooting or a particular discipline in sport target shooting, such as ISU, sillouhette, or whatever that should create a separate book on that discipline. However a book on a given discipline was not intended in this book. This was intended to be a discussion of the theoretical and practical aspects of marksman ship.
 * I see no legal issues in using human shaped targets in a book.
 * I concede that there are potentially ethical issues. However some people would content that merely having a book on marksman ship is in itself an ethical issue. I have no intention of pandering to them.
 * I do not recall any instance in my original contribution to killing or injuring people, (Other than the graphics in question - whcih I re-iterate I am happy for someone else to repalce with graphics which replace convey the same content with different shaped targets).
 * I don't agree that the majority of people looking for an article on marksmanship would be military. However I don't see that a s a reson to ignore the fact that the military has an interest in marksmanship and that some methods of marksmanship may be more militarily orentated than others (or indeed that some methods may be more civilian orientated).
 * I also don;t see why either civilian or military aspects of marksmanship should be ignored.
 * I do understand the purpose of human shaped as targets in desensitizing people to the taboo of killing people, such as examined by Grossman, Marshall and others. However I think it is a very, very wide stretch of the imagination to think that using diagrams with human shaped targets in an article on marksmanship will desensitize a person sufficiently for them to find it easier or possible to shoot people. That type of conditioning requires more than the use viewing of pictures of targets that a human or abstract human in form. SO while I agree that the use of human/abstract human targets is a tool in desensitizing people to kill other people, I can not in my wildest imagination see that the inclusion of the diagrams I included would in anyway contribute to desensitizing a reader of the book/article, anymore than the inclusion a say a historical panting, a news photograph or a screen shot from a video game depicting killing people would contribute to desensitizing a person.
 * I would however concede that actually suing human/abstract human target in marksmanship practice might a desensitizing effect under the right conditions. However I do no recall advocating the use of such targets in my earlier contributions.
 * Again if you don't want human shaped targets in the diagrams, thats fine - but please replace instead of simply deleting the diagrams supplied. I.e. contribute somthing yourself instead of just crticising/destorying someone else's contribution.
 * I will say that I do think it is very naive though to think that it will make a difference to remove or replace human shaped targets, and I think it is rude and ignorant to assume that your moral and ethical beliefs are more important, more correct or should take precedence over mine.

title: Talk:Marksmanship


text:
Structural Engineering

What is Structural Engineering?
Structural engineering is a branch of engineering which deals with the analysis and design of various structural systems. Although this branch of engineering has influence on various other disciplines like mechanical or aeronautical engineering, etc., it is more commonly identified with civil engineering. Structural engineering deals with conception, design, and construction of the structural systems that are needed in support of human civil engineering

"Structural engineering is the art of molding materials we do not really understand into shapes we cannot really analyze, so as to withstand forces we cannot really assess, in sucha a way that the public does not really suspect."  British structural engineer Dr. E. H. Brown, from his book Structural Analysis

Engineers are the invisible presence that brings the architect or designer's concept into reality. In a broad sense, architects create the skin defining the usable flow of space that we live and work - occasionally appearing to defy gravity. The Engineer relies on the physical sciences to create a "skeleton" of interconnected elements that support the shell in the physical world. He or she uses the laws of physics (equilibrium) to design the structure (in part and in whole) to safely support the weight of the permanent building materials, changing movement of people, and short term applications of snow and water. These are defined as the vertical "gravity" loads (NOTE: Refer to topics related to; live, dead, and short-term loads) while resisting the "horizontal" forces of nature due to the worst case comparing; wind and seismic events that may act simualtaneously. Equilibrium is achieved by anchoring the structure to an adequate foundation based on the recommendations of a geotechnical (soils) engineer. Starting at the top and working down to the foundation, the engineer designs each element and the connections supporting the combination of elements to create the "structure" - a sum of its elements (whether a building, soil retaining wall or a bridge). The engineer follows building codes, enacted in state congress to create law that provides a minimum requirement to protect life safety. Working with different building materials (wood, steel, concrete, masonry and/or proprietary connectors and structural systems). LQEngineer (talk) 05:13, 1 September 2009 (UTC)

Structural Engineering Activities
Structural engineering is mainly involved with two activities
 * 1. Structural Analysis
 * 2. Structural Design

Structural Analysis
It deals with analyzing a particular structural system. A structural system may vary from simple systems (like beams, columns, slabs, etc.) to more complex systems (like frames, bridges, piers, foundations, retaining walls, etc.). The objective behind analysis is to estimate or find resultant stresses (or forces) so that these elements can be designed to withstand the load that comes over it.

Idealized Structures
In reality the exact analysis of a structure can never be carried out. Idealizing a structure is a method of conservatively simplifying the components of the structural system, while keeping its behavior under loading the same. This is done in order to simplify calculations. Without an idealized structure, design could take a massively longer amount of time... and sometimes becomes impossible. It is important for a structural engineer to develop methods to idealize a structure in order to carry out analysis.

Supports for Coplanar Structures
Structural Members are joined together by supports depending on the intent of the engineer. Three types of joints most often used are pin connections, roller supports, and fixed joints. Pin connections provide vertical and lateral support, but cannot provide a moment reaction. A roller support can only supply a reaction of a force in one direction. A fixed joint provides vertical, lateral as well as a moment reaction.

Analysis of Statically Determinate Trusses
Typically done using method of joints, method of sections or graphical methods.

Internal Loadings Developed in Structural Members
Internal loadings are found by "cutting" the member and applying the equations of equilibrium to an isolated section.

Cables and Arches
What are Cables and Arches?

Cables are structural elements that can only withstand loads in tension.

Arches are structural elements that withstand loads in compression.

Influence Lines for Statically Determinate Structures
Influence lines are a diagram that represents variation of a loading function at one location on a structure. For example, a truck drives across a bridge:

When the truck is at the left side on top of the bridge, very little loading is felt at the right support. The function represented by influence lines changes as the truck moves towards the right end of the bridge. The loading at the right support grows as the truck nears it, until the truck reaches the far end, where the end realizes the maximum loading. Influence lines for statically determinate structures consist of a straight line.

Deflections
Deflections occur naturally in structures from various sources. Loads and temperature changes are sources of deflections that structural engineers have to design for because they are unavoidable. Designs must be made in order to avoid cracking of the materials used. Fabrication or Design Errors can lead to failure of structures and should be avoided through careful planning and analysis.

Structures in most cases are built with materials that can withstand the designed loading and only have a linear elastic response. Under these conditions loads may cause deflections, but when the load is removed the structure will return to it original shape and strength. Overloading beyond the linear elastic response may cause damage and failure of the structure. This is referred to as "plastic deformation".

Elastic-Beam Theory
If a material is homogeneous and behaves in a linear elastic manner we can derive a nonlinear second order differential equation that when solved through the double integration method can give a solution deflection as a function of x. We must assume $$dv/dx =0$$ relative to the length of the beam in the x-axial direction.

$$\frac{d^2v}{dx^2} = \frac{M}{EI}$$

M = the internal moment in the beam E = the material's modulus of elasticity I = the beam's moment of inertia computed about the neutral axis v = deflection of beam

The Double Integration Method
When Moment can be expressed as a function of position x, then performing single integration will yield the beam's slope as a function of x, and the equation of the elastic curve. Performing double integration will yield the beam's deflection for any position of x

The two integrations will yield two constants of integration. Using the boundary conditions the constants can be solved for.

First theorem

 * If the strain energy of an elastic structure can be expressed as a function of generalized displacement qi; then the partial derivative of the strain energy with respect to generalized displacement gives the generalized force Qi.

Using this theorem the generalized forces acting on the structure can be calculated.

Second theorem

 * If the strain energy of a linearly elastic structure can be expressed as a function of generalized force Qi; then the partial derivative of the strain energy with respect to generalized force gives the generalized displacement qi in the direction of Qi.

Using this theorem the generalized displacement of the structure can be calculated. Castigliano's method usually refers to the application of his second theorem.

Structural Design
Structural design is the process of selecting members of required dimensions such that they provide adequate stability under service loads. There are two conditions that a structural designer must keep in mind. One is "stability" and the other is "serviceability". Stability of a structure means that it can resist the loads acting on it satisfactorily and that the structure will not collapse immediately (that is, it provides enough time to escape to safety). Serviceability refers to certain conditions that are required so that the structure remains serviceable. For example, consider a bridge that can resist service loads without collapse. This is a "stable" structure. Now assume that this bridge shows abnormal deflections. The deflections could be such that the bridge feels bouncy and could lead to steering problems for vehicles crossing it at high speeds. As such this may not cause the structure to collapse. So we can say that the structure is stable, but according to serviceability criterion it is not serviceable because people could feel afraid of using the bridge.

In the design and construction of the foundation and framing for buildings and bridges, the main materials used are concrete, steel, timber, and masonry. Steel can further be subdivided into two subsections: hot-rolled steel and cold-formed steel. Cold-formed steel applies to material of approximately 1/8" or less in thickness that is either folded or roll-formed from flat sheets into structural shapes while at room temperature.

Safety Factors
All structures must be designed to carry all foreseeable loads with a suitable factor of safety. Clearly it would be unsafe to walk on a structure that was adequate but had no margin of safety built in. With this in mind, most countries have standards that prescribe the required minimum safety factors for structures. The minimum is usually a factor of about 1.7. This is not a factor to allow for overloading or poor workmanship. If there is a possibility of overloading or poor workmanship, the design loads must be increased to account for the overloading and the strengths of the materials upon which the design is based must be reduced to account for the poor workmanship. The safety factor must remain complete, as it is there to account for the unexpected events and unforeseen circumstances. If a structure becomes worn, loose, cracked or corroded, it should always be repaired so the safety factor is preserved.

title: Structural Engineering


text:
Talk:X86 Disassembly/Analysis Tools

We can bump this page up to 50% completed if we can list a few Linux debuggers. beyond that, we should probably include some screenshots, and some tips on effective debugging (perhaps even make a distinction between live analysis and dead listing). --Whiteknight 03:54, 20 September 2005 (UTC)

I think some of the Linux-debuggers here are not "debuggers" per se at all. Some of them should probably be moved to the "other tools" section, but i dont know this for a fact. --129.32.61.137 13:47, 20 September 2005 (UTC)

 * Can you define what a "debugger" is? I can use those tools for debugging; therefore they are debuggers. :-) The page isn't called "traditional debuggers" or "interactive debuggers" or "GUI debuggers". Weird scriptable tools can be very powerful. AlbertCahalan 14:16, 20 September 2005 (UTC)
 * Good point, but some of the tools, specifically readelf or objdump fit better into the section on "Other tools", as a counterpoint to the windows dumpbin utility already listed there. I've been defining debugger as a program that allows single-stepping, breakpoints, and analysis. Tools not specifically used in this manner have been moved to the "Other tools" section. It is important to focus on few issues per chapter, to prevent confusing the reader. If the book says that every reader should have "at least one debugger" when reading this book, it would probably be counterproductive if the reader only downloads Lizard or ReadELF, because those dont do the job that "debuggers" do in this book.--Whiteknight
 * I think Lizard does single-stepping... in both directions! AlbertCahalan 00:01, 22 September 2005 (UTC)
 * Well if it does allow single-stepping, then perhaps we can include it here as well, although i dont think it has a particularly bad home in the "Other Tools" page. --Whiteknight 19:36, 7 October 2005 (UTC)

title: Talk:X86 Disassembly/Analysis Tools


text:
Wikibooks talk:Engineering bookshelf

I would like to contribute to a basic, first college semester electrical engineering text, but I am confused about which category would be appropriate to write under: electrical engineering, electronic engineering, or the physics electronics section, which seems to hold information I would consider appropriate to electrical engineering. How should we delineate these categories?

Thanks much,

Jill Coffin

Please go ahead and start writing. One of the nice features of this wiki is that a book can be in several categories at the same time. For example, the Electronics book is on the Physics bookshelf as well as the Engineering bookshelf. --DavidCary 16:44, 3 October 2006 (UTC)

Electrical Engineering
I have written up a general outline of a few EE books on my user page, and would like to get some feedback about them. I've started books on Circuit Theory and Digital Circuits, which will form an introductory base for the rest of the books. --Whiteknight 14:24, 7 October 2005 (UTC)

Electrical Engineering and Electronic engineering
I was wondering if we could merge the titles of electrical and electronic engineering, they are both the same exact subject. Another engineering topic 'Computer engineering' is the same as electrical but focuses more on digital logic and programable controllers. so would it be possible to merge electronic and electrical and then rename it to Electrical/Computer engineering? --Asm2750 19.37, 22 March 2006 (UTC)

 * I merged the two sections, and included a note. I did not, however, rename the section "Electrical/Computer Engineering". Such a change would break alot of links, I think. --Whiteknight (talk) (projects) 23:41, 25 June 2006 (UTC)

I would like to add my opinion(s) to this discussion about electrical/electronic engineering. In particular, I do not believe (as Asm2750 asserts) they are "the same exact subject".

Electrical engineering is concerned with the provision (generation, transmission, distribution, etc.) of electricity. Electronics engineering is concerned with the manipulation of the electrical supply in more complex processes ("electron" ics, related to the behaviour of electrons). Electronics is more concerned with the manipulation and study of the flow of charge within a circuit.

I am an Electronic Technologist. To distinguish my specialty from that of the electrician, I often tell people "The Electrician is the person who provides the power. The Electronics Technician (or Technologist, or Engineer, etc.) is the person who makes it get up and dance.

If you will check "Electrical Engineering" in Wikipedia, http://en.wikipedia.org/wiki/Electrical_engineering you will find opinions similar to those I have just stated. Thank You.

Books to be moved
I think the text in Theoretical Mechanics is more aproriate here instead of the Physics Bookshelf --Mart!n

I moved Basic Electricity in Physics to Basic Electrical Generation and Distribution, and it should be removed from the Physics bookshelf and placed on the Electrical Engineering shelf. My first contribution over on wikibooks, so I'm not sure of the protocol. I know right now it is a redirect from Basic Electricity, but I don't want to sever that as there are a dozen or so links.

Jtvisona 02:47, 8 March 2007 (UTC)

Both materials science texts need to be moved out of civil engineering and, most appropriatly, placed under a new heading called materials science.SmoJoe (talk) 18:05, 6 March 2008 (UTC)

Low completion rating
Electric Vehicle Conversion is tagged as only 25% - this seems low, given the current state of the article - Leonard G. 02:48, 21 October 2007 (UTC)

title: Wikibooks talk:Engineering bookshelf


text:
Ada Programming/Error handling

Error handling techniques
This chapter describes various error handling techniques. First the technique is described, then its use is shown with an example function and a call to that function. We use the √ function which should report an error condition when called with a negative parameter.

To be specific: Exceptions is the Ada way to go.

Return code
Error_Handling_1 Square_Root (X : Float)  Float Ada.Numerics.Elementary_Functions; X < 0.0 -1.0;         Sqrt (X); ;   Square_Root; C := Square_Root (A ** 2 + B ** 2); C < 0.0 T_IO.Put ("C cannot be calculated!"); T_IO.Put ("C is "); F_IO.Put (Item => C,        Fore => F_IO.Default_Fore,         Aft  => F_IO.Default_Aft,         Exp  => F_IO.Default_Exp); ; Error_Handling_1;

Our example makes use of the fact that all valid return values for √ are positive and therefore -1 can be used as an error indicator. However this technique won't work when all possible return values are valid and no return value is available as error indicator; hence to use this method is a very bad idea.

Error (success) indicator parameter
An error condition is returned via additional out parameter. Traditionally the indicator is either a boolean with "true = success" or an enumeration with the first element being "Ok" and other elements indicating various error conditions.

Error_Handling_2 Square_Root (Y      :  Float;      X       :   Float;      Success :  Boolean) Ada.Numerics.Elementary_Functions; X < 0.0 Y      := 0.0; Success := False; Y      := Sqrt (X); Success := True; ;     ;    Square_Root; Square_Root (Y      => C,      X       => A ** 2 + B ** 2,      Success => Success); Success T_IO.Put ("C is "); F_IO.Put (Item => C); T_IO.Put ("C cannot be calculated!"); ; Error_Handling_2;

One restriction for Ada up to Ada 2005 is that functions cannot have out parameters. (Functions can have any side effects but may not show them). So for our example we had to use a procedure instead. The bad news is that the Success parameter value can easily be ignored.

In Ada 2012, functions may have parameters of any mode; hence this is possible at last:

Square_Root (X      :   Float;      Success :  Boolean)  Float ...

This technique does not look very nice in mathematical calculations; hence no good idea either.

Global variable
An error condition is stored inside a global variable. This variable is then read directly or indirectly via a function.

Error_Handling_3 Float_Error : Boolean; Square_Root (X : Float)  Float Ada.Numerics.Elementary_Functions; X < 0.0 Float_Error := True; 0.0;         Sqrt (X); ;   Square_Root; Float_Error := False; -- reset the indicator before use C := Square_Root (A ** 2 + B ** 2); Float_Error T_IO.Put ("C cannot be calculated!"); T_IO.Put ("C is "); F_IO.Put (Item => C,        Fore => F_IO.Default_Fore,         Aft  => F_IO.Default_Aft,         Exp  => F_IO.Default_Exp); ; Error_Handling_3;

As you can see from the source, the problematic part of this technique is choosing the place at which the flag is reset. You could either have the callee or the caller do that.

Also this technique is not suitable for multithreading.

Use of global variables for cases like this indeed is a very bad idea, in effect one of the worst.

Exceptions
Ada supports a form of error handling that has long been used by other languages like the classic  from early Basic dialects to the   exception handling from modern object oriented languages.

The idea is: You register some part of your program as error handler to be called whenever an error happens. You can even define more than one handler to handle different kinds of errors separately. Once an error occurs, the execution jumps to the error handler and continues there; it is impossible to return to the location where the error occurred.

This is the Ada way!

Error_Handling_4 Root_Error: ; Square_Root (X : Float)  Float Ada.Numerics.Elementary_Functions; X < 0.0 Root_Error; Sqrt (X); ;   Square_Root; C := Square_Root (A ** 2 + B ** 2); T_IO.Put ("C is "); F_IO.Put (Item => C,        Fore => F_IO.Default_Fore,         Aft  => F_IO.Default_Aft,         Exp  => F_IO.Default_Exp); Root_Error => T_IO.Put ("C cannot be calculated!"); Error_Handling_4;

The great strength of exceptions handling is that it can block several operations within one exception handler. This eases the burden of error handling since not every function or procedure call needs to be checked independently for successful execution.

Design by contract
In Design by Contract (DbC), operations must be called with the correct parameters. This is the caller's part of the contract. If the subtypes of the actual arguments match the subtypes of the formal arguments, and if the actual arguments have values that make the function's preconditions True, then the subprogram gets a chance to fulfill its postcondition. Otherwise an error condition occurs.

Now you might wonder how that is going to work. Let's look at the example first:

Error_Handling_5 Square_Root_Type Float  0.0 .. Float'; Square_Root (X   :  Square_Root_Type) Square_Root_Type Ada.Numerics.Elementary_Functions; Sqrt (X); Square_Root; C := Square_Root (A ** 2 + B ** 2); T_IO.Put ("C is "); F_IO.Put (Item => C,     Fore => F_IO.Default_Fore,      Aft  => F_IO.Default_Aft,      Exp  => F_IO.Default_Exp); ; Error_Handling_5;

As you can see, the function requires a precondition of  — that is, the function can only be called when X ≥ 0. In return the function promises as postcondition that the return value is also ≥ 0.

In a full DbC approach, the postcondition will state a relation that fully describes the value that results when running the function, something like. This postcondition is √'s part of the contract. The use of assertions, annotations, or a language's type system for expressing the precondition  exhibits two important aspects of Design by Contract:

 * 1) There can be ways for the compiler, or analysis tool, to help check the contracts. (Here for example, this is the case when   follows from X's subtype, and √'s argument when called is of the same subtype, hence also ≥ 0.)
 * 2) The precondition can be mechanically checked before the function is called.

The 1st aspect adds to safety: No programmer is perfect. Each part of the contract that needs to be checked by the programmers themselves has a high probability for mistakes.

The 2nd aspect is important for optimization — when the contract can be checked at compile time, no runtime check is needed. You might not have noticed but if you think about it: $$A^2 + B^2$$ is never negative, provided the exponentiation operator and the addition operator work in the usual way.

We have made 5 nice error handling examples for a piece of code which never fails. And this is the great opportunity for controlling some runtime aspects of DbC: You can now safely turn checks off, and the code optimizer can omit the actual range checks.

DbC languages distinguish themselves on how they act in the face of a contract breach:

 * 1) True DbC programming languages combine DbC with exception handling — raising an exception when a contract breach is detected at runtime, and providing the means to restart the failing routine or block in a known good state.
 * 2) Static analysis tools check all contracts at analysis time and demand that the code written in such a way that no contract can ever be breached at runtime.

Ada 2012 has introduced pre- and postcondition aspects.

Wikibook

 * Ada Programming
 * Ada Programming/Exceptions

Ada 2005 Reference Manual

|Error handling

title: Ada Programming/Error handling


text:
Template:Computer Programming/Error Handling/0

This computer programming article is available in pseudocode and Ada.


text:
Gmail

This book is a guide to using Gmail — Google's web email service.

Contents

 * 1) /Introduction/
 * 2) /Gmail basic/
 * 3) /The Design/
 * 4) /Send mail/
 * 5) /Read mail/
 * 6) /Search/
 * 7) /Contacts/
 * 8) /Stars/
 * 9) /Gmail advanced/
 * 10) /Filters/
 * 11) /Invite a friend/
 * 12) /Labels/
 * 13) /Forwarding and POP/IMAP/
 * 14) /Settings/
 * 15)  The To:, CC:, and BCC: fields
 * 16) Chatting with Gmail
 * 17) /Last tips/
 * 18) /Other/
 * 19) Gmail as a filesystem on Linux
 * 20) Gmail as a filesystem on Windows

title: Gmail


text:
Vietnamese/Consonants

 * There are 17 single consonants:

 * There are 10 consonant digraphs:

There is one consonant trigraph: ngh /ŋ/: nghỉ, nghiêm, nghiêng

 * There are 8 final consonants:

title: Vietnamese/Consonants


text:
Ruby Programming/Method Calling

= super =

The super keyword can be used to call a method of the same name in the superclass of the class making the call. Values passed to the super call are passed into the parent method.

Example: class SomeClass def initialize(name) end end

class ChildClass < SomeClass def initialize(name, value) super(name) end end

A call to the  function of the child class above will result in the execution of both its body and the body of the   function in the parent class.

Note that if you invoke super without arguments, all arguments to executing method will be passed to the parent method as well - and if parent's signature does not match the number of arguments, an exception will be raised. So, if the child version of the method uses a different number of arguments than the version in superclass, you need to list arguments that you want to pass to the parent's version of the method.

Note also that you can use any method name, not just initialize (in this case).

= iterators = Iterators provide a method for cycling through a set of values and performing an operation, usually specified by a code block, for each value. Iterator functionality is often provided through the mixin  module.

The first iterator that Ruby programmers are likely to encounter is the  iterator.

Example: arr = [1,2,3] arr.each do |number| put number end

Outputs: 1 2  3

= yield =

executes the entire code block passed to the method.

Example:

def do3times yield yield yield end do3times { puts "yielding..." }

Outputs:

yielding... yielding...  yielding...

You can therefore make your own method looking like the built-in :

class Fixnum def times_plus1 i = 1 while i <= self + 1 i += 1 yield end end end

5.times_plus1 { puts "yielding..." }

Outputs:

yielding... yielding...  yielding...  yielding...  yielding...  yielding...

|

title: Ruby Programming/Method Calling


text:
Gmail/Gmail basic

Now you (might) have Gmail. So it's time to learn how to use Gmail. Soon you think it's easy, and will be able to say "That's right, Gmail is easy to use."

 * The Design
 * Send mail
 * Read mail
 * Search
 * Contacts
 * Stars

Back - Content - Next

title: Gmail/Gmail basic


text:
Category:Book:Movie Making Manual

How to make movies!

title: Category:Book:Movie Making Manual


text:
Visual Basic/JArithmetic Round Two

=Introduction= Now that the excitement of having something actually work has worn off we can take a critical look at what we have done.

What have we done? We have shown that:

 * we can 'create' an editor that lets us format text with text attributes such as bold face, italic, etc.
 * we can execute the text and put the result back in the text.

Sounds good but the list of things we haven't done and haven't considered is much longer. Here are some of the obvious entries:

 * What about text that is not part of a formula,
 * Where should the results go? Surely not at the bottom of the page.
 * Didn't we mention charts in our wish list?
 * There is a lot more to formatting than bold,italic and underline.
 * What is supposed to happen when the user writes something that the program doesn't understand?

In order to make some visible progress it is often a good idea to tackle the easy problems first, at least if they are problems that must be solved and not just vague wishes. The problem is of course that we don't know which problems are easiest to solve without examining them. Sometimes examining the problem just turns up more problems, sometimes it will turn out to not really be a problem at all.

Lets take our not done items in turn.

=Text that is not part of a formula= Our prototype works by passing the whole text of the document to the Script object. This means that the whole text must be legal in the language of the script engine. Our formulas are just statements in that language. Programs are composed of three types of things:

 * statements
 * comments
 * whitespace

So the text that is not part of a formula is by definition either whitespace or comments. If it contains any printable characters then it can't be whitespace so it must be comments. So, we can include any text we like so long as it can be contained in comments because the scripting engine will just treat it as whitespace and ignore it.

There are several different syntaxes for comments, sometimes one language will allow more than one type. When using the language purely for programming it usually doesn't matter very much how comments are delineated but in our case the comments will be a very important part of the text so it is important that the syntax doesn't get in the way. We have already decided to limit ourselves to either VBScript or JScript so all we have to do is decide which has the better syntax for comments, while bearing in mind that we might want to change our mind later for other reasons.

The syntax for comments in VBScript is very simple, it is the same as Visual Basic. A comment is introduced by a single ASCII quotation mark:

' this is a comment

or the word REM (case doesn't matter):

rem this line ReM and this line are both comments

JScript is a little different:

// this is a single line comment

/* this is also a single line comment */

but:

/* This is    a      multiline comment */

For our purposes I think it is obvious that the JScript syntax is more convenient for writing paragraphs of text. If we use JScript then we can simply write our text and formulas quite naturally except for remembering to enclose the blocks of text in /*..*/. Best of all we don't have to do any extra programming to make this work.

Exercises

 * Run the program and add comments using the two different comment styles. Run the document to convince yourself that the comments do not affect the result.

=Where should the output go?= So far the output has simply been appended to the end of the document. This is obviously not very useful. We probably want to be able to put the answers near the questions, values near the formulas that determine them.

Also we don't want repeated evaluations to add new copies of the values to the end of the document. One way around this is to place some special sequence of characters in the text that will be replaced by the answers. For instance we could write a document that looks something like this:

Ttop=55 // deg C Tbot=Ttop-6 /* The bottom temperature is . Which is six degrees below the top. */

The first line sets variable Ttop to 55, the next calculates the value of Tbot. Then we have a multiline comment that has embedded in it the character sequence ; this is called a macro.

Now we can execute the program which will set the values of the variables and then we can scan the program text looking for macros. When we find a macro we can ask the Script object for the value of the variable it names and replace the macro with the value.

It is easy to find the macros, just a few InStr calls will do it or we can get more sophisticated and use regular expressions. After evaluation and macro substitution the document would look like this:

Ttop=55 // deg C Tbot=Ttop-6 /* The bottom temperature is 49. Which is six degrees below the top. */

Unfortunately there is a serious flaw in this scheme: it only works the first time we evaluate the document. This is because we have replaced the macro with the value just as though we were running a normal macro-processor; see, for example, m4 Macro Processor Overview. If we modify the document to change the constant 6 to 9 and re-evaluate the document the result will not change.

In our case the input document is also the output document so we have to insert the output in such a way that it can be re-evaluated and have the results updated.

One solution is to modify the method by which we show the result so that the macro is not replaced but is instead modified. Then the document might look like this after evaluation:

Ttop=55 // deg C Tbot=Ttop-6 /* The bottom temperature is . Which is six degrees below the top. */

Now we just have to make some simple modifications to the code, as yet unwritten, that scans the text for the macros and to the code that inserts the result. All that is required is that we recognize the macro and split it into two parts: name and  value. The name and the characters that are used to indicate that this is a macro are left unchanged while the value is replaced. When you write the document you would write the macro like this:

That is, the value is empty and will be filled in when the value is known.

Exercises

 * Try to think of a general procedure for replacing the placeholders with the values of the variables.
 * What will happen if the same variable has different values in different parts of the document? What should happen?

=Charts and other objects= Understanding that there are different ways of viewing the same thing and that different things can be viewed in the same way is one of the most important lessons to be learnt in computer programming.

If we regard charts as simply another kind of value all questions regarding the generation and inclusion of charts become questions about what kind of function has to be written to generate the value and how to automatically insert that value in the document. Once the problem is phrased in this way it becomes obvious that we can use the same macro technique to display a chart that we use to display a number. now all we have to do is create a function that creates a chart.

Of course there are lots of details to be dealt with yet. Still if we simply assume that there is a function somewhere that creates charts, perhaps as bitmap images, all we have to do is find a way of calling it.

=Formatting= In principle we can use any formatting that is supported by the Rich Text Box control. we should be able to provide hot keys, menus and toolbar buttons to set the type face, type size, indentation, justification and so on.

=Syntax errors, typing mistakes, etc= To do.

Exercises

 * Create a new project with a Rich text Box control. Experiment with the properties and methods of the control to set type faces, sizes, indentation, etc.  Create a button for each feature.
 * Extend the application to let the user pick the type face, etc., by showing the font selection dialog box.

title: Visual Basic/JArithmetic Round Two


text:
Template:Computer Programming/Error Handling/1

Error handling techniques
This chapter describes various error handling techniques. First the technique is described, then its use is shown with an example function and a call to that function. We use the √ function which should report an error condition when called with a negative parameter.


text:
Template:Computer Programming/Error Handling/2

Our example make use of the fact that all valid return values for √ are positive and therefore -1 can be used as an error indicator. However this technique won't work when all possible return values are valid and no return value is available as error indicator.

Error (success) indicator parameter
An error condition is returned via additional out parameter. Traditionally the indicator is either a boolean with "true = success" or an enumeration with the first element being "Ok" and other elements indicating various error conditions.


text:
Template:Rueda de Casino/Command TR

Rueda de Casino/

title: Template:Rueda de Casino/Command TR


text:
Template:Computer Programming/Error Handling/3

This technique does not look very nice in mathematical calculations.

Global variable
An error condition is stored inside a global variable. This variable is then read directly or indirectly via a function.


text:
Template:Computer Programming/Error Handling/4

As you can see from the source the problematic part of this technique is choosing the place at which the flag is reset. You could either have the callee or the caller do that.

Also this technique is not suitable for multithreading.

Exceptions
The programming language supports some form of error handling. This ranges from the classic  from early Basic dialects to the   exceptions handling from modern object oriented languages.

The idea is always the same: you register some part of your program as error handler to be called whenever an error happens. Modern designs allow you to define more than one handler to handle different types of errors separately.

Once an error occurs the execution jumps to the error handler and continues there.


text:
Template:Computer Programming/Error Handling/6

As you see the function demands a precondition of  - that is the function can only be called when X ≥ 0. In return the function promises as postcondition that the return value is also ≥ 0.

In a full DbC approach, the postcondition will state a relation that fully describes the value that results when running the function, something like. This postcondition is √'s part of the contract. The use of assertions, annotations, or a language's type system for expressing the precondition  exhibits two important aspects of Design by Contract:

 * 1) There can be ways for the compiler, or analysis tool, to help check the contracts.  (Here for example, this is the case when   follows from X's type, and √'s argument when called is of the same type, hence also ≥ 0.)
 * 2) The precondition can be mechanically checked before the function is called.

The 1st aspect adds to safety: No programmer is perfect. Each part of the contract that needs to be checked by the programmers themselves has a high probability for mistakes.

The 2nd aspect is important for optimization — when the contract can be checked at compile time, no runtime check is needed. You might not have noticed but if you think about it: $$A^2 + B^2$$ is never negative, provided the exponentiation operator and the addition operator work in the usual way.

We have made 5 nice error handling examples for a piece of code which never fails. And this is the great opportunity for controlling some runtime aspects of DbC: You can now safely turn checks off, and the code optimizer can omit the actual range checks.

DbC languages distinguish themselves on how they act in the face of a contract breach:

 * 1) True DbC programming languages combine DbC with exception handling — raising an exception when a contract breach is detected at runtime, and providing the means to restart the failing routine or block in a known good state.
 * 2) Static analysis tools check all contracts at analysis time and demand that the code written in such a way that no contract can ever be breached at runtime.


text:
Template:Computer Programming/Error Handling/5

The great strength of exceptions handling is that it can block several operations within one exception handler. This eases up the burden of error handling since not every function or procedure call needs to be checked independently for successful execution.

Design by Contract
In Design by Contract (DbC) functions must be called with the correct parameters. This is the caller's part of the contract. If the types of actual arguments match the types of formal arguments, and if the actual arguments have values that make the function's preconditions True, then the subprogram gets a chance to fulfill its postcondition. Otherwise an error condition occurs. Now you might wonder how that is going to work. Let's look at the example first:


text:
Category:Book:Computer Programming

fr:Catégorie:Programmation pt:Categoria:Programação th:หมวดหมู่:การเขียนโปรแกรมคอมพิวเตอร์

title: Category:Book:Computer Programming


text:
Category:Book:Movie Making Manual/Funding and budgetting

Funding and budgeting for filmmakers

/Pre-production /Production


text:
Category:Book:Movie Making Manual/Contracts and law

Contracts and legal issues for filmmakers

/Pre-production /Production


text:
Category:Book:Movie Making Manual/Actors

Actors and filmmaking

/Directing


text:
Movie Making Manual/Build your own editing system

=Why build your own computer?=

It's cheaper to build your own workstation than to buy one off the shelf. While this might not be true for low-end computers, we're building a decent workstation. Many computer manufacturers make their profit from "workstation" class computers. If you build your own computer and put your research in, you can build a fast, stable and efficient machine for maybe 30% less than a similarly spec'd off-the-shelf system. An important note to make is that while you can build a custom Windows PC, you cannot build a custom Apple system: Apple's software is only available on machines they build. However, this has not stopped Final Cut Pro from being a preferred editing solution. The Mac Pro offers a large variety of build-to-order options, and ranges in price from $2000 - $20 000, depending on processors, hard drive space, RAM, and video cards.

=Software=

Generally it works best to pick out the software first, and then get whatever hardware is necessary to run the chosen software. See Movie Making Manual/Equipment and software reviews for some software recommendations.

=Hardware components=

General requirements
Editing video requires a powerful computer. If you're planning on working on feature-length films, or working with extensive special effects, this is even more important. Your home computer might be capable of piecing together your vacation footage, but if you want to able to properly edit a longer film, you need a good machine. RAM and storage capacity are the most important things here: one minute of uncompressed digital video, as is outputted from a standard MiniDV camcorder, takes up roughly one gigabyte of storage.

(nope: DV uses DV compression, which is cbr-ish, so there is no 'roughly' either, one minute of DV footage will be 227.601.996 bytes)

If you plan on working in High Definition, this figure jumps much higher.

(nope: you can work in HD by using some cheap formats like HDV, same bitrate as with DV footage)

Storage

 * Use separate drives for system (e.g a SSD or 10,000rpm SATA) and storage (e.g. SATA RAID array). SATA (good value and modern) is an excellent alternative to SCSI (older and expensive).

RAM
RAM these days is very cheap and upto 16GB or more is very affordable with 4GB being a recommended minimum. Remember however that Windows 7 Home Premium will only recognise a maximum of 16GB.
 * Depending on your operating system, at least 1GB. If you're using Windows Vista, Microsoft recommends 1GB just to run the OS, so a minimum of 2GB is wise.

Computer monitor
This is perhaps the most important part of your purchase: computer monitors are very different from TV screens, and what looks good on a monitor might not look good on a TV. If you plan on doing any colour correction, a high quality monitor is a must. Most editing systems also have a large number of different panels, meaning that the larger your screen size, the better. A dual monitor setup is a wise choice.

Top Choices in Computer Monitors
 * [|Cinema Display]
 * [|Dell Ultrashrap]

Many Apple and Dell monitors use the exact same LCD panel, so the monitors are actually very comparable in performance.

Graphics card
ATI and nVidia offer graphic cards specially designed for workstations:

 * ATI FireMV/FireGL
 * nVidia QuadroFX

You can edit videos without these graphic cards, but they make editing a lot smoother, especially real-time effects.

CPU

 * A Dual-CPU system is preferable, usually server-CPU's like the Intel Xeon and the AMD Opteron are used. If you choose to use desktop-CPU's, an Intel Pentium 4 is better suited for this job than an AMD Athlon 64. New processors from Intel such as the Core 2 Duo are also very well suited to this task.

Update: The Athlon 64 x2 line of cpus outperform Intel cpus including the core 2 duos. Consider using Athlon chips if you want faster rendering times and smoother realtime editing capabilities.

Motherboard
Ensure the motherboard can handle the components you need, with the possibility of expansion. Additional slots for RAM are handy.

DVD Burner

 * A reliable, dual/double layer burner. Don't be fooled by burners advertising high speed: it is best to burn at low speeds to reduce the chance of errors.

Case

 * Big, quiet, cool, lots of storage

Power Supply

 * A powerful power supply is a must: an editing station will require lots of power to function properly.

Keyboard

 * Editing keyboards have all the short cuts already on the keys. You can buy these keyboards off-the-shelf, or you can buy a standard keyboard and buy stick-on labels.

Pointing device

 * Consider a graphics tablet because makes fine control of the mouse much easier (it's like using a pen). Be wary of cheap graphics tablets because they can suffer from judder (i.e. the mouse pointers appears to judder even though your hand is still).  You'll need fine control for such tasks as:
 * Jogging back and forth through rushes in a frame-accurate way
 * Rotoscoping

=Assemble=

See How To Assemble A Desktop PC for details on how to put all those parts together.

=Overclocking=

 * WikiPedia article on OverClocking

In a film production environment, where deadlines are tight and speed is everything, overclocking your workstation can seem like a tempting option. However, overclocking a modern computer takes a great deal of patience and knowledge to do correctly. As such, it's generally OK to overclock your home computer but a bad idea to overclock a production system. Why? Because stability is essential in film production.

That said, it is possible to overclock and maintain stability if you're carefull, patient and have the right components.

/Tools and equipment /Editing


text:
Gmail/Facts

Gmail is a free, search-based webmail service that includes 15 gigabytes of storage. The backbone of Gmail is a powerful Google search engine that quickly finds any message an account owner has ever sent or received. That means there's no need to file messages in order to find them again.

When Gmail displays an email, it automatically shows all the replies to that email as well, so users can view a message in the context of a conversation. There are no pop-ups or untargeted banner ads in Gmail, which places relevant text ads and links to related web pages adjacent to email messages.

 * Cost: Free
 * Storage: 15,360 megabytes
 * Superior spam protection using innovative Google technology
 * Languages: Messages can be sent and read in most languages. The Gmail interface is available in 39 languages: US and UK English, simplified and traditional Chinese, Bulgarian, Catalan, Croatian, Czech, Danish, Dutch, Estonian, Filipino, Finnish, French, German, Greek, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Italian, Japanese, Korean, Latvian, Lithuanian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swedish, Thai, Turkish, Ukrainian, and Vietnamese.
 * Access: Free automatic forwarding, POP3 access and IMAP access (not a full implementation)

Back - Content - Next
 * JavaScript and cookies must be enabled on all browsers
 * Fully supported browsers:
 * Chrome
 * Mozilla Firefox
 * Microsoft Edge
 * Safari
 * Opera
 * Many other browsers work with Gmail's basic HTML view, including:
 * Microsoft IE 4.0+
 * Netscape 4.07+
 * Lynx

title: Gmail/Facts


text:
Category:Book:Movie Making Manual/Post-production

Post-production is what happens after production.


text:
Talk:Russian/Verbal Aspect

Untitled
The verbs быть and жить seem to have aspectual pairs. Быть-пробыть, жить-прожить. The article says they don't. Need more explanation about that.

First, thanks to the unknown author for this article about the verbs of my mother language. I have a minor comment about the Verbal "Pairs". Not a great deal, but the author may wish to clarify the second para in same "Pairs". The thing is that the perfective verb разговорить does NOT mean "to converse" or "to chat". It means to complete encouraging, making or even forcing somebody else to speak. For example: A teacher may разговорить a shy student (so that the student would give a complete and exhausting answer). A private eye   or a policemen under cover may разговорить a witness or neighbours (so as to get some useful information through conversing  or just chatting). An executor may разговорить a suspect by torturing. Hence, I think that the pair говорить - (раз)говорить is a bit misleading. Possibly, another pair думать-подумать would better fit into the subject para. Думать means "to think", подумать means "to give some thought". Sorry about interfering and excuse my English. Sincerely, Taurox -The-Native-Russian-Speaker  :)

Confusing example
A fragment of the article promises an example of perfective and imperfective verbs formed by adding a prefix to the opposite element in the pair. However they provide three examples in which the verbs in both aspects either have the exact same beginning, or have no resemblance to one another. The author either does not understand what the meaning of prefix is or they chose to provide examples that do not involve prefixes despite introducing them as such.

The fragment in question:

(Quote)

So we have three pairs derived using prefixes:

говорить (impf.) and сказать (pf.)

отговаривать (impf.) and отговорить (pf.)

договариваться (impf.) and договориться (pf.)

(End quote)

This didn't help me at all to understand how to modify verbs to introduce aspect. I'm now more confused than I was before reading the article.

title: Talk:Russian/Verbal Aspect


text: C++ Programming/Charter

title: C++ Programming/Charter


text:
Cellular Automata/Partial Differential Equations

We traditionally describe phenomena in differential equations, but we would like to simulate and eventually predict their behaviour using numerical methods. This can be done using a traditional top-down approach or a less common bottom up approach.

An inverted method would be to construct from bottom up a cellular automaton, with the same properties as the observed phenomenon differential equation.

The top down approach
The transformation of a differential equation into a discrete system that can be simulated on a computer is called the top-down approach. Let us try a simple example. One dimensional diffusion equation
 * $$ \frac{\partial C}{\partial t} = \kappa \frac{\partial^2 C}{\partial x^2} $$

is discretized forward in time and symmetric in space
 * $$ c_x^t = c_x^{t-1} + k \left( c_{x+1}^{t-1} - 2c_{x}^{t-1} + c_{x-1}^{t-1} \right) = c_x^t = k\, c_{x+1}^{t-1} + \left(1-2k\right) c_{x}^{t-1} + k\, c_{x-1}^{t-1} $$

with $$k := \kappa\,{\Delta t}\,({\Delta x})^{-2}$$. The produced discrete equation can be seen as a cellular automaton local transition function
 * $$ c_x^t = f \left( c_{x+1}^{t-1} c_{x}^{t-1} c_{x-1}^{t-1} \right) $$

The time and space discretization is the same for both systems but there is a crucial difference in the discretization of variables. On a common computer a variable is represented using 64-bit floating point numbers whereas a cellular automaton has variables of 2 to 8 bits.

As numerical approximation errors is an important problem using floating point numbers and would be unbearable using only a few bits. We see that there is no direct method to for transforming differential equations into cellular automata, a different approach must be used.

The bottom-up approach
This approach begins with selecting a discrete system that inherently possesses some basic properties needed for a simplified model of the original problem. An example of such basic properties is reversibility and preservation of quantities as mass, momentum and energy. The model is then modified and trimmed till it is sufficiently close to the original problem.

The basic model is usually as simple as possible. If cellular automata are used for the basic model, their neighborhood


text:
Talk:X86 Disassembly/Windows Executable Files

This page has some good coverage so far, but i dont think we can give it a higher completion percentage until we get good coverage of the Import/Export tables, and at least some discussion about resources. --Whiteknight 14:45, 20 September 2005 (UTC)

Found some errors in the structs. Here are the corrections that work for me: struct DOS_Header {    char signature[2]; short lastsize; short nblocks; short nreloc; short hdrsize; short minalloc; short maxalloc; void *sp; short checksum; void *ip; short relocpos; short noverlay; char extra[28]; DWORD relocs; }; struct COFFHeader {   char dwSIG[4]; short Machine; short NumberOfSections; long TimeDateStamp; //  long a, b, c; //   short d;    long a;    long PointerToSymbolTable; short SizeOfOptionalHeader; short Characteristics; }; struct PEOptHeader {   short signature; //decimal number 267. char MajorLinkerVersion; char MinorLinkerVersion; long SizeOfCode; long SizeOfInitializedData; long SizeOfUninitializedData; long AddressOfEntryPoint; //The RVA of the code entry point long BaseOfCode; long BaseOfData; long ImageBase; long SectionAlignment; long FileAlignment; short MajorOSVersion; short MinorOSVersion; short MajorImageVersion; short MinorImageVersion; short MajorSubsystemVersion; short MinorSubsystemVersion; long Reserved; long SizeOfImage; long SizeOfHeaders; long Checksum; short Subsystem; short DLLCharacteristics; long SizeOfStackReserve; long SizeOfStackCommit; long SizeOfHeapReserve; long SizeOfHeapCommit; long LoaderFlags; long NumberOfRvaAndSizes; }; struct RVA { 	long VirtualAddress; long Size; }; --84.182.207.19 21:56, 14 October 2005 (UTC)

That really should not be using "long". For many of us, "long" can be 64-bit and a "WORD" is 32-bit. You can use the proper types from inttypes.h or, since Windows 3.1 and Xenix are dead, you can assume that an int is 32-bit. AlbertCahalan 02:00, 15 October 2005 (UTC)

I'm aware that certain types are platform dependent, but why has no one bothered correcting the actual page? It would be great if it was accurate; I was unable to find a lot of information on this topic elsewhere. --84.182.240.46 08:27, 15 October 2005 (UTC)

This should also explain how to convert RVAs to file offsets. I'm trying to create a program that extracts resources from an EXE file. I've managed to find the ".rsrc" section of the EXE file, and parsed the directory structure. However the IMAGE_RESOURCE_DATA_ENTRY structure is giving me problems, as the "long *Data;" entry in this structure is given as RVA (an offset in virtual memory, relative to the start of the program's virtual memory space, once the EXE file is already running and loaded in memory), and NOT as an offset in the EXE file itself, nor as an offset relative to the start of the ".rsrc" section. How do I convert RVA to file-offset, so I can extract the resources from the EXE file, without running the EXE file? 76.104.147.215 (discuss) 06:14, 16 December 2014 (UTC)