Thursday, 29 January 2009
How I made new Microsoft C++ compiler work without Visual Studio installation
1. I downloaded and installed free Visual C++ 2008 Express Edition
http://www.microsoft.com/express/download/
2. I created target directory d:\c15 and a file setvars.bat with the following content
set C15=d:\c15
set PATH=%C15%\bin;%PATH%
set INCLUDE=%C15%\include
set LIB=%C15%\lib
3. I copied files
mspdb80.dll
from "Microsoft Visual Studio 9.0\Common7\IDE\" into "d:\c15\bin\"
c1.dll, c1xx.dll, c2.dll, cl.exe, link.exe
from "Microsoft Visual Studio 9.0\VC\bin\" into "d:\c15\bin\"
whole directory 1033
from "Microsoft Visual Studio 9.0\VC\bin\" into "d:\c15\bin\"
whole directory include
from "Microsoft Visual Studio 9.0\VC\" into "d:\c15\"
libcmt.lib, libcpmt.lib, oldnames.lib
from "Microsoft Visual Studio 9.0\VC\lib\" into "d:\c15\lib\"
Kernel32.Lib
from "Microsoft SDKs\Windows\v6.0A\Lib" into "d:\c15\lib\"
4. At this moment I was able to compile C++ programs with the copied compiler. I started cmd, cleaned the PATH variable, run setvars (step 1), and cl.exe compiled the C++ and C programs. But when I moved this directory to the computer which does not have Visual studio installed then cl.exe failed with a message: "The system cannot execute the specified program".
5. I looked into cl.exe binary searching for the string "manifest". That part is XML. Noted the lines
name="Microsoft.VC90.CRT" version="9.0.21022.8"
Note: version reported by cl.exe is different!
6. I went into C:\WINDOWS\WinSxS\Manifests and found file
Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375.manifest
Note: version numbers match!
7. I copied this file into "d:\c15\bin" directory and renamed it into
Microsoft.VC90.CRT.manifest
Note: the name in step 1, the name of the file, and the name inside this file is the same "Microsoft.VC90.CRT"!
8. I went into C:\WINDOWS\WinSxS and found directory
x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
Note: version match!
9. Copied all dlls from this directory into "d:\c15\bin" directory.
Voila, it worked in Virtual Windows with no Visual Studio installation.
Wednesday, 10 December 2008
Intelligent design
Simplistic View On Evolution
Thursday, 2 October 2008
Saccade hypothesis
According to the current belief the main reason for saccades of the human eye is that the central part of the retina, the fovea, plays a critical role in resolving objects. By moving the eye so that small parts of a scene can be sensed with greater resolution, body resources can be used more efficiently.
In my opinion this is not the case. The main reason for saccades is building abstract invariant of the picture. In visual cortex the information propagates up the higher level by building more abstract notation of the picture. The voluntary changing of the picture is the way for the cortex to deduce the common information. The crucial role here is that the brain (cortex) knows that the real cause (objects being seen) does not change. So the cortex must be working differently when the picture coming from the retina changes due to external factors or changes due to internally motivated saccades.
The memory prediction mechanism allows comparing the changed picture with the predicted according to a particular distance and direction of the saccade. This is done in partly learned memory. But the same mechanism works as finding the nvariants in the changing pictures produced by slightly different view.
The analogy of this process is the theory and the experiment. The theory is proven by different experiments giving the different results but fitting in the theory prediction. The assumption is that the essence does not change with the experiments.
"Saccades are a widespread phenomenon across animals with image-forming visual systems. They have been observed in animals across three phyla, including animals that do not have a fovea (most vertebrates do not) and animals that cannot move their eyes independently of their head (such as insects)." [Land, MF. "Motion and vision: why animals move their eyes". J Comp Physiol A. 1999 185:341–352.] Although in this paper the author argues that the reason for saccades "is the need to avoid the blur that results from the long response time of the photoreceptors".
Assuming that building image invariant is the main reason for saccades, one would come to a conclusion that the other voluntary picture changes should happen in the eye. Indeed, some animals allow their eye rotate [above paper]. Why human eyes do not rotate I do not know. Maybe our vision system is complex enough (3D) to allow less emphasis on obtaining picture.
Sensory cortex and saccade motor cortex must be closely coupled. Because the sensory cortex governs the motor cortex and motor cortex has to feed back its lower level information to sensory cortex. There should be many effects which can easily be tested by experiments to support this hypothesis.
Thursday, 25 September 2008
How to measure chaos
I studied the reversible algorithms of arithmetic multiplication (factorization problem). I have found a very interesting fact that when the information describing the ensemble grows fast, this exact process is difficult to reverse, i.e. find feasible computation reverse algorithm. Let me explain by example of computation.
Suppose there is an initial set of N bits {x}. If all bits are independent and can initially be set to either 0 or 1, then this is the ensemble of 2N states. Now suppose we have a function G describing all forbidden states of the ensemble. [The same up to inversion arguments would go with all allowable states.] Initially G=0, since all values of x are allowed.
Next suppose that we have a computational process which is done in atomic steps. Each step can be one of two kinds: either creating a new bit or forgetting an old. For example, add a new bit y1=x1&x2 (let us signify & as AND operation, | as OR, and ^ as XOR). The G function becomes y1^(x1&x2) if previous G=0, or in general case Gnext=Gprevious|y1^(x1&x2). Forgetting a bit x2 would make Gnext=Gx2=0&Gx2=1, where Gx2=0 is G with x2 replaced with 0.
It seems easy to keep G function defined while doing the calculation process. This is important because while we know G function the calculation is immediately reversible – it is easy at each backward step find out the previous forgotten bit. But the problem appears when G function becomes impractically huge in representation. This happens, for example, with arithmetic multiplication. The only way to attack this problem is to find symmetries in the function so to make it computationally practical, smaller.
Suppose that with a given intellectual strength we find the smallest representation of G function. This function can be written as a sequence of the atomic steps A=B&C, where A,B,C are bits or their negations (say A=B|C is ~A=~B&~C). The negation is not an operation, rather a perception of the bit. With this representation the function becomes measurable in number of atomic computational steps.
That makes it very natural to define the chaos as the increase of the size of the function G. Note that the definition includes the intellectual strength of the observer, which seems natural for the definition of chaos. Also it qualitatively resembles Lyapunov exponents as chaos measure.
Monday, 15 September 2008
Precise theory for Artificial Intelligence
Completely different situation is with Artificial Intelligence research area. Here are concepts of information, memory, awareness giving completely different philosophical theories depending on how the concepts are being understood. There is so big variety of opinions that it is difficult to call this area of research scientific. Nevertheless some groups of people sharing the same beliefs are able to communicate and even to make some progress in ideas. But with no practical results. Obviously now the understanding of the problem in question is different than ten years ago. Hopefully a simple model can be built in some near future, just to give the common basis for terminology used in this field.
Wednesday, 16 July 2008
Beating the nature
Wednesday, 9 January 2008
Monday, 10 December 2007
Number of features grows logarithmically
Friday, 7 September 2007
On coding practices
So 3 points influencing the style are:
1. Personal taste: You personal choice
2. Simplicity/clarity: Do not sacrifice clarity to your or other people's taste
3. Community: What most (other) people expect to see when looking at the code.
My personal preferences are:
1. Find which community is likely to work later with the code.
2. Follow coding rules if they do not disagree with your taste and code clarity.
3. If a rule is not good from your point of view, decide which one: your taste or community is more important in that context.
4. If a rule makes code less simple or clear, ignore the rule. [This is very subjective so be prepare to stand for your opinion]
19.04.2007
Wednesday, 29 August 2007
Console/Window executables
0000: 4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00 MZ_ ♥ ♦ яя
0010: B8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 ё @
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 _
0040: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 ♫▼є♫ _○Н!ё☺LН!Th
0050: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F is program canno
0060: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 t be run in DOS
0070: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 00 mode.♪♪◙$
0080: 50 45 00 00 4C 01 12 00 7B DA D4 46 00 68 5E 00 PE L☺↕ {ЪФF h^
0090: 34 1F 00 00 E0 00 06 01 0B 01 02 38 00 50 0A 00 4▼ а ♠☺♂☺☻8 P◙
00A0: 00 1C 10 00 00 F8 20 00 A0 12 00 00 00 10 00 00 ∟► ш ↕ ►
00B0: 00 60 0A 00 00 00 40 00 00 10 00 00 00 02 00 00 `◙ @ ► ☻
00C0: 04 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 ♦ ☺ ♦
00D0: 00 F0 7F 00 00 06 00 00 4A 86 63 00 03 00 00 00 р⌂ ♠ J┼c ♥
00E0: 00 00 20 00 00 10 00 00 00 00 10 00 00 10 00 00 ► ► ►
00F0: 00 00 00 00 10 00 00 00 00 90 30 00 22 46 00 00 ► _0 "F
0100: 00 E0 30 00 98 20 00 00 00 00 00 00 00 00 00 00 а0 _
0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0120: 00 10 31 00 88 4B 00 00 00 00 00 00 00 00 00 00 ►1 _K
0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
This flag is at the end of the line 00D0. This flag is not in absolute offset so you may try to guess.
Wednesday, 15 August 2007
Software complexity limit
Under design I mean here all development solutions on the whole scale from architectural to coding. Under process I mean here the standards accepted by the development team.
Thursday, 26 July 2007
Notes on programming
Programming is a fight against the complexity
When a program is being developed its complexity may increase or remain the same. We can define the program complexity as the complexity of its most complex component (the component decomposition can be seen as a separate component itself). It would be an interesting question what kind of program modifications increase the complexity and what do not.
Complexity multiplies but capacity does not sum up
A number of people cannot create a program which is more complex than at least one of these people can understand. From the other hand, linearly adding a new component of lesser complexity that already exists does not increase the overall complexity. Keyword here is “linearly”, which means that complexity of the decomposition (referring to the level on which the component added) does not increase as well, or increase so as not to outweigh the overall complexity. But making the new component interdependent with existing components opens new dimensions in internal states of the program (non-linearity) that is multiplying the complexity.
Architecture
Each character of the code has its own path to the top level concept of the program. Top level concept of the program lies on the abstract layers braking up the program architecture into independent components, which are lying on lower level layers and so on until we reach each separate character of the code.
Understanding this path from the bottom level to the top level is architectural awareness. It is important that the programmer has one. Otherwise the complexity of the product can grow incredibly fast.
Push, pop, and pull requirements
The requirements evolve from the customer to the final coder. It is not possible to imagine that the programmer can develop a program targeting each customer requirement individually.
The requirements can be generally grouped into 3 categories.
- Customer requirements (Pull). Something which defines the product.
- Architect requirements (Pop). The model which can be implemented in software and is proven to mimic the customer definition of the product. These requirements are conditions to components and their interaction.
- Code requirements (Push). Testable functionality of the program.
Push requirements are satisfied when the program undergoes a number of scenarios defined the requirements. This can be done by auto scripts validating expected output.
Pop requirements are satisfied when the program conforms to the defined component interfaces. This can be done by documented and frozen APIs.
Pull requirements are satisfied automatically given that the model is adequate to the required product. These can be customer acceptance tests, but they would not be a part of the product development.
Failure to break the requirements into these 3 categories and treat the customer requirements as the requirements to the software leads to ad hoc style programming. Programs written in this way are difficult to modify and they are sources of plentiful hard tracking bugs. This can work only for small programs.
Thursday, 10 May 2007
Visual Studio 2005 Express, OpenGL and Glut
Visual Studio 2005 Express does not have SDK. Instead of installing huge SDK what I did to make Visual Studio 2005 Express to run with openGl and Glut is the following.
1. Downloaded and unpacked
glutdlls37beta.zip
and
opengl95.exe
(ftp://ftp.microsoft.com/softlib/mslfiles/opengl95.exe)
2. copied glut32.dll into windows directory
3. created dir GL in include
in my case it was
C:\Program Files\Microsoft Visual Studio 8\VC\include\GL
4. copied *.h files in there
5. copied *.lib files in lib directory
in my case it was in
C:\Program Files\Microsoft Visual Studio 8\VC\lib
Also have a look at:
http://www.opengl.org/resources/faq/technical/gettingstarted.htm
(2.060 What do I need to compile and run OpenGL programs?)
