Server Development 2007. 11. 23. 00:27
반응형

WFC Technical Note 006 - Funny Memory Values

Introduction

Microsoft has put quite a lot of memory leak detection helpers in Windows NT. They have not done a good job of advertising it. This document describes some of the things I've deciphered while debugging code.

Funny Memory Values

Many times while debugging programs, I will come across memory that is filled with "funny" values. After some playing around (i.e. hacking) with the Win32 API, I was able to figure out what they meant. Some of these values have been documented in places but never all together. The values for the tags presented here are hexadecimal because that's the way Developer's Studio presents them in the memory window.

 Value  Meaning
 0xAB
or
 0xABAB 
or
 0xABABABAB 
 Memory following a block allocated by LocalAlloc().
 0xBAADF00D  Bad Food. Get it? This is memory allocated via LocalAlloc( LMEM_FIXED, ... ). It is memory that has been allocated but not yet written to.
 0xFEEE
 0xFEEEFEEE
 This seems to be memory that has been dedicated to a heap but not yet allocated by HeapAlloc() or LocalAlloc().
 0xCC
or
 0xCCCC
or
 0xCCCCCCCC
 Microsoft Visual C++ compiled code with the /GZ is automatically initialized the uninitialized variable with this value.
 0xCD
or
 0xCDCD
or
 0xCDCDCDCD
 Microsoft Visual C++ compiled code with memory leak detection turned on. Usually, DEBUG_NEW was defined. Memory with this tag signifies memory that has been allocated (by malloc() or new) but never written to the application.
 0xDD
or
 0xDDDD
or
 0xDDDDDDDD
 Microsoft Visual C++ compiled code with memory leak detection turned on. Usually, DEBUG_NEW was defined. Memory with this tag signifies memory that has been freed (by free() or delete) by the application. It is how you can detect writing to memory that has already been freed. For example, if you look at an allocated memory structure (or C++ class) and most of the members contain this tag value, you are probably writing to a structure that has been freed.
 0xFD
or
 0xFDFD
or
 0xFDFDFDFD
 Microsoft Visual C++ compiled code with memory leak detection turned on. Usually, DEBUG_NEW was defined. Memory with this tag signifies memory that is in "no-mans-land." These are bytes just before and just after an allocated block. They are used to detect array-out-of-bounds errors. This is great for detecting off-by-one errors.

디버그 힙 사용시일 때 표가 의미가 있다. 물론 스택은 관계없다. 아래 값 상태를 알아두면 좋다.

메모리값  의미
0xCDCD CDCD      힙에 할당된 메모리다.그러나 초기화 되지 않았다.
0xDDDDDDDD 힙에서 Free된 메모리이다.
0xFDFDFDFD "NoMansLand?"(아무도 여기에 있어서는 안된다. 즉 자동적으로 할당된 힙 메모리 바운더리에 놓여지는 값이다. 결고 overwrite되선 안되고, 만약 이 값이 변경되면 할당된 영역이상 쓰여진 것이다. 이럴 경우 VC에서 경고를 내준다.
0xCCCCCCCC 스택에 할당된 메모리이다. 그러나 초기화 되지 않았다.

여기서 특히나 0xCCCCCCCC 는 특별한 의미인데. 이것은 어셈블리어로 따지자면 __asm int 3 이다. 이것은 브레이크포인터와 같다. 따라서 프로그래머가 이 영역을 초기화 없이 접근하여 사용시에는 user break point를 내준다.(메세지도 이렇게 나오는 것을 한번쯤 봤을 것이다.) 이것은 VC가 디버그 모드에서는 이런식으로 할당된 변수 값들을 채워줌으로써 프로그래머의 실수를 최대한 막아준다. 이런 값들은 포인터 변수값이 초기화 상태가 아닐 때 값을 보면 디버그 모드에서는 항상 이런 값임을 확인해 볼 수 있다.



출처 : http://www.samblackburn.com/wfc/technotes/WTN006.htm

반응형
posted by choiwonwoo
:
etc 2007. 11. 23. 00:12
반응형
요즘 각 IT회사마다 구글처럼 시험을 보는곳이 늘고 있다.
아래에는 구글의 입사문제가 있는데..쩝...
좌절이다...

Mathematica's Google Aptitude

By Ed Pegg Jr. and Eric W. Weisstein

With additional contributions by Daniel Lichtblau, Adam Strzebonski, Oyvind Tafjord, and Michael Trott

October 13--Many internet denizens have heard of Sergey Brin, President of Technology at google.com. What they may not know is that before cofounding the precursor to Google in 1998 and subsequently becoming a multibillionaire, Brin was an intern at Wolfram Research (makers of Mathematica, as well as sponsors of MathWorld).

The Billboard

So perhaps it's no great surprise that Google utilizes unusually mathematically oriented recruitment techniques. In fact, these practices have received widespread coverage in the last few weeks and months following the erection of a mathematical billboard in Silicon Valley on southbound Highway 101 near Ralston, California in July 2004. The billboard poses the question of finding the first 10-digit prime number occurring in consecutive digits (i.e., the decimal expansion) of the mathematical constant known as e, which is a transcendental number whose first few digits are 2.7182818284.... The unusal nature of the billboard prompted coverage through numerous mainstream media outlets such as National Public Radio, The Boston Globe, and the Oakland Tribune, as well as (of course) on the internet.

Ed mentioned the puzzle on his MathPuzzle website on July 13, 2004. Minutes after its posting, Wolfram Research CEO and A New Kind of Science author Stephen Wolfram sent the solution as a single line of Mathematica code:

Select[FromDigits/@Partition[First[RealDigits[E,10,1000]],10,1],PrimeQ,1]

{7427466391}

The Billboard, Level 2

Upon determining this value and typing the corresponding URL http://7427466391.com into a web browser, a potential Google employee (or curious MathWorld news story reader) is taken to a web page congratulating him (or her) and providing instructions for the second level of the puzzle, which involves finding the next term of the following sequence:

f(1)= 7182818284
f(2)= 8182845904
f(3)= 8747135266
f(4)= 7427466391
f(5)= __________

If the first two terms look familiar, that's because they are 10-digit portions of the decimal expansion of e given above. In fact, a little extra analysis shows that they are precisely those 10-digit portions summing to 49. After having determined that, it is easy to find the next number, again using Mathematica:

FromDigits/@Select[Partition[First[RealDigits[E,10,1000]],10,1],Total[#]==49&,5]

{7182818284,8182845904,8747135266,7427466391,5966290435}
This is sequence A095926 in Neil Sloane's On-Line Encyclopedia of Integer Sequences.

While we could likely continue this discussion at least a little further, we prefer at this juncture to leave additional levels of the billboard puzzle to the enterprising reader.

Son of Billboard: The Google Labs Aptitude Test

On September 30, Google concocted an even more challenging recruitment device: the Google Labs Aptitude Test. Hardcopies of this test were also distributed to University of Illinois students in the October 12 edition of The Daily Illini. While some of the questions on the test relate more to computer knowledge and general creativity, many of them are highly mathematical. And for the these problems, Mathematica clearly shows its extremely high mathematical aptitude by solving them easily, especially when guided by a little research on MathWorld and other online resources such as the On-Line Encyclopedia of Integer Sequences.

We thank our former intern for doing his part in bringing fun mathematics problems into the news. A Mathematica version of the test, with answers, is available for download below.

file format size
AptitudeTest.nb notebook 92 K

Google Labs Aptitude Test Partially Answered

1. Solve this cryptic equation, realizing of course that values for M and E could be interchanged. No leading zeros are allowed.

WWWDOT - GOOGLE = DOTCOM

This can be solved through systematic application of logic.  For example, O cannot be equal to 0, since O + O +[1 or  0] = W.  That would make W1, but D + GW, which is not possible.

Here is a slow brute-force method of solution that takes a few minutes on a relatively fast machine:

Off[General :: "spell1"] chars = Characters/@ToLowerCase/@{"WWWDOT", "GOOGLE", "DOTCOM"} ; uchars = Union[Flatten[chars]] ;

eqn = First[#] - Plus @@ Rest[#] &[FromDigits[#, 10] &/@chars] == 0 ; Timing[soln = Select[Permutations[Range[0, 9]], eqn/.Thread[ucharsMost[#]] &]]

{359.3 Second, {{4, 5, 3, 1, 0, 6, 8, 9, 7, 2}, {4, 5, 6, 1, 0, 3, 8, 9, 7, 2}}}

Thread[ucharsMost[#]] &/@soln

{{c4, d5, e3, g1, l0, m6, o8, t ... , d5, e6, g1, l0, m3, o8, t9, w7}}

This gives the two solutions

777589 - 188106 == 589483
777589 - 188103 == 589486

Here is another solution using Mathematica's Reduce command:

eqn = "wwwdot" - "google""dotcom"/.s_StringFromD ... eqs&&#, vars, Integers] &/@eqs, (Unequal @@ vars/.ToRules[#]) =!= False&]//Timing

{96.98 Second, c4&&d5&&e3&&g1&& ... p;&l0&&m3&&o8&&t9&&w7}

A faster (but slightly more obscure) piece of code is the following:

cf = Compile[Evaluate[{#, _Integer} &/@{c, d, e, g, l, m, o, t, w, x}], Module[ {& ...  {d, o, t, c, o} . S ; A - B - mC + e&&A - B - eC + m] ] ;

Transpose[{{c, d, e, g, l, m, o, t, w}, Most[#]}] &/@Module[{perms = Developer`ToPackedArray/@Take[Permutations[Range[0, 9]], All]}, Select[perms, cf @@ #1&]]//Timing

{49.89 Second, {{{c, 4}, {d, 5}, {e, 3}, {g, 1}, {l, 0}, {m, 6}, {o, 8}, {t, 9}, {w, 7}}, {{c, 4}, {d, 5}, {e, 6}, {g, 1}, {l, 0}, {m, 3}, {o, 8}, {t, 9}, {w, 7}}}}

Faster still using the same approach (and requiring ~300 MB of memory):

Transpose[{{c, d, e, g, l, m, o, t, w}, Most[#]}] &/@Compile[{}, Module[{perms = Take[Perm ... d, o, t, c, o} . S ; A - B - mC + e&&A - B - eC + m]]]]][]//Timing

{14.65 Second, {{{c, 4}, {d, 5}, {e, 3}, {g, 1}, {l, 0}, {m, 6}, {o, 8}, {t, 9}, {w, 7}}, {{c, 4}, {d, 5}, {e, 6}, {g, 1}, {l, 0}, {m, 3}, {o, 8}, {t, 9}, {w, 7}}}}

Even faster using the same approach (that does not exclude leading zeros in the solution, but that can easily be weeded out at the end):

eq = Simplify["wwwdot" - "google" - "dotcom"/.s_StringFr ... ers[s]], 10]] ; Join[CoefficientList[eq, #][[2]] &/@Union[Cases[eq, _Symbol, Infinity]], {0}]

{-100, -99900, -1, -100100, -10, -1, -21000, -999, 111000, 0}

Transpose[{{c, d, e, g, l, m, o, t, w}, Most[#]}] &/@Compile[{}, Select[Permutations[Range ... , 9]], {-100, -99900, -1, -100100, -10, -1, -21000, -999, 111000, 0} . #0&]][]//Timing

{6.44 Second, {{{c, 4}, {d, 5}, {e, 3}, {g, 1}, {l, 0}, {m, 6}, {o, 8}, {t, 9}, {w, 7}}, {{c, 4}, {d, 5}, {e, 6}, {g, 1}, {l, 0}, {m, 3}, {o, 8}, {t, 9}, {w, 7}}}}

Here is an independent solution method that uses branch-and-prune techniques:

wwwdot = {w, w, w, d, o, t} ; google = {g, o, o, g, l, e} ; dotcom = {d, o, t, c, o, m} ; vars ... en[{eqn, vareqns, zeroOneConstraints, noLeadingZeros, mustSumToOneConstraints, distinctDigits}] ;

Developer`SetSystemOptions["LinearProgrammingOptions" {"InteriorPointSize"1, "Preprocessing"True}] ;

Off[General :: "spell1"]

wwwdotgoogledotcom[constraints_, vars_, zeroOneVars_] := Module[{allvars = Join[vars, zeroOneV ...  zeroOneVars[[badpos]] 1], stack} ;] ;] ; Sort/@Map[Reverse, solns, {2}] ]

wwwdotgoogledotcom[allInfo, vars, Flatten[newvars]]//Timing

{72.89 Second, {{{c, 4}, {d, 5}, {e, 3}, {g, 1}, {l, 0}, {m, 6}, {o, 8}, {t, 9}, {w, 7}}, {{c, 4}, {d, 5}, {e, 6}, {g, 1}, {l, 0}, {m, 3}, {o, 8}, {t, 9}, {w, 7}}}}

And the winner for overall fastest:

enforceUniqueDigits[l_, k_] := If[Length[Union[Take[l, -k]]] =!= k, Sequence @@ {}, l] <br/>  ...  &/@Select[dgclotem, dotcom[#, 6] + google[#, 6] wwwdot[#, 6] &])//Timing

{2.58 Second, {{c4, d5, e6, g1, l0, m3, oɳ ...  d5, e3, g1, l0, m6, o8, t9, w7}}}

2. Write a haiku describing possible methods for predicting search traffic seasonality.

MathWorld's search engine
seemed slowed this May. Undergrads
prepping for finals.

3.       1
         1 1
         2 1
      1 2 1 1
   1 1 1 2 2 1

What's the next line?  

312211.  This is the "look and say" sequence in which each term after the first describes the previous term: one 1 (11); two 1s (21); one 2 and one 1 (1211); one 1, one 2, and two 1's (111221); and so on.  See the look and say sequence entry on MathWorld for a complete write-up and the algebraic form of a fascinating related quantity known as Conway's constant.

RunLengthEncode[x_List] := (Through[{First, Length}[#1]] &)/@Split[x] LookAndSay[n_, d_:1] := NestList[Flatten[Reverse/@RunLengthEncode[#]] &, {d}, n - 1]

FromDigits/@LookAndSay[6]

{1, 11, 21, 1211, 111221, 312211}

4. You are in a maze of twisty little passages, all alike.  There is a dusty laptop here with a weak wireless connection.  There are dull, lifeless gnomes strolling around.  What dost thou do?

    A) Wander aimlessly, bumping into obstacles until you are eaten by a grue.
    B) Use the laptop as a digging device to tunnel to the next level.
    C) Play MPoRPG until the battery dies along with your hopes.
    D) Use the computer to map the nodes of the maze and discover an exit path.
    E) Email your resume to Google, tell the lead gnome you quit and find yourself in whole different world [sic].

In general, make a state diagram.  However, this method would not work in certain pathological cases such as, say, a fractal maze.  For an example of this and commentary, see Ed Pegg's column about state diagrams and mazes.

5. What's broken with Unix?

Their reproductive capabilities.

How would you fix it?

[This exercise is left to the reader.]

6. On your first day at Google, you discover that your cubicle mate wrote the textbook you used as a primary resource in your first year of graduate school. Do you:

    A) Fawn obsequiously and ask if you can have an autograph.
    B) Sit perfectly still and use only soft keystrokes to avoid disturbing her concentration
    C) Leave her daily offerings of granola and English toffee from the food bins.
    D) Quote your favorite formula from the textbook and explain how it's now your mantra.
    E) Show her how example 17b could have been solved with 34 fewer lines of code.

[This exercise is left to the reader.]

7. Which of the following expresses Google's over-arching philosophy?

    A) "I'm feeling lucky"
    B) "Don't be evil"
    C) "Oh, I already fixed that"
    D) "You should never be more than 50 feet from food"
    E) All of the above

[This exercise is left to the reader.]

8. How many different ways can you color an icosahedron with one of three colors on each face?

For an asymmetric 20-sided solid, there are 3^20 possible 3-colorings.  For a symmetric 20-sided object, the Pólya enumeration theorem can be used to obtain the number of distinct colorings.  Here is a concise Mathematica implementation:

Off[General :: "shdw", General :: "spell1"] <<DiscreteMath`Combinato ...  GroupFaces = KSubsetGroup[GroupI, Sort/@f] ; Polya[GroupFaces, colors] ]

ColorMySolid[Icosahedron, colors]

(2 colors^4)/5 + colors^8/3 + colors^10/4 + colors^20/60

%/.colors 3

58130055

What colors would you choose?

[This exercise is left to the reader.]

9. This space left intentionally blank.  Please fill it with something that improves upon emptiness.

For nearly 10,000 images of mathematical functions, see The Wolfram Functions Site visualization gallery.

10. On an infinite, two-dimensional, rectangular lattice of 1-ohm resistors, what is the resistance between two nodes that are a knight's move away?

R[m_, n_] := 1/(2π) Integrate[1/t (1 - ((t - I)/(t + I))^(m + n) ((t - 1)/(t + 1))^Abs[m - n]), {t, 0, ∞}]

R[1, 2]

(8 - π)/(2 π)

This problem is discussed in J. Cserti's 1999 arXiv preprint.  It is also discussed in The Mathematica GuideBook for Symbolics, the forthcoming fourth volume in Michael Trott's GuideBook series, the first two of which were published just last week by Springer-Verlag.  The contents for all four GuideBooks, including the two not yet published, are available on the DVD distributed with the first two GuideBooks.

11. It's 2PM on a sunny Sunday afternoon in the Bay Area.  You're minutes from the Pacific Ocean, redwood forest hiking trails and world class cultural attractions.  What do you do?

[This exercise is left to the reader.]

12. In your opinion, what is the most beautiful math equation ever derived?

There are obviously many candidates.  The following list gives ten of the authors' favorites:

1. Archimedes' recurrence formula: a_ (2 n) = (2 a_n b_n)/(a_n + b_n), b_ (2 n) = (a_ (2 n) b_n)^(1/2), a_n>π>b_n, a_∞ = b_∞
2. Euler formula: ^( π) + 10
3. Euler-Mascheroni constant: Underscript[lim, k∞]   (Underoverscript[∑, n = 1, arg3] 1/n - log(k)) 
4. Riemann hypothesis: ζ (α + β ) 0 and β≠0 implies α1/2
5. Gaussian integral:   ∫_ (-∞)^∞^(-x^2) xπ^(1/2)
6. Ramanujan's prime product formula: Underoverscript[∏, k = 1, arg3] (p_k^2 + 1)/(p_k^2 - 1) 5/2
7. Zeta-regularized product: Underoverscript[∏, k = 1, arg3] k (2 π)^(1/2)
8. Mandelbrot set recursion: z_ (n + 1) z_n^2 + C
9. BBP formula: πUnderoverscript[∑, n = 0, arg3] (-2/(8 n + 4) - 1/(8 n + 5) - 1/(8 n + 6) + 4/(8 n + 1)) (1/16)^n
10. Cauchy integral formula: f(z_0) 1/(2 π ) ∮f(z)/(z - z_0) z

An excellent paper discussing the most beautiful equations in physics is Daniel Z. Freedman's "Some beautiful equations of mathematical physics."  Note that the physics view on beauty in equations is less uniform than the mathematical one.  To quote the not-necessarily-standard view of theoretical physicist P.A.M. Dirac, "It is more important to have beauty in one's equations than to have them fit experiment."

13. Which of the following is NOT an actual interest group formed by Google employees?

    A. Women's basketball
    B. Buffy fans
    C. Cricketeers
    D. Nobel winners
    E. Wine club

[This exercise is left to the reader.]

14. What will be the next great improvement in search technology?

Semantic searching of mathematical formulas.  See http://functions.wolfram.com/About/ourvision.html for work currently underway at Wolfram Research that will be made available in the near future.

15. What is the optimal size of a project team, above which additional members do not contribute productivity equivalent to the percentage increase in the staff size?

    A) 1
    B) 3
    C) 5
    D) 11
    E) 24

[This exercise is left to the reader.]

16. Given a triangle ABC, how would you use only a compass and straight edge to find a point P such that triangles ABP, ACP and BCP have equal perimeters?  (Assume that ABC is constructed so that a solution does exist.)

This is the isoperimetric point, which is at the center of the larger Soddy circle. It is related to Apollonius' problem. The three tangent circles are easy to construct: The circle around C has diameter a + b - c, which gives the other two circles.  A summary of compass and straightedge constructions for the outer Soddy circle can be found in "Apollonius' Problem: A Study of Solutions and Their Connections" by David Gisch and Jason M. Ribando.

17. Consider a function which, for a given whole number n, returns the number of ones required when writing out all numbers between 0 and n.  For example, f(13)=6.  Notice that f(1)=1.  What is the next largest n such that f(n)=n?

The following Mathematica code computes the difference between [the cumulative number of 1s in the positive integers up to n] and [the value of n itself] as n ranges from 1 to 500,000:

data = MapIndexed[#1 - #2[[1]] &, Rest[FoldList[Plus, 0, Table[DigitCount[n, 10, 1], {n, 500000}]]]] ;

<<Graphics`Colors` ListPlot[Take[MapIndexed[{#2[[1]], #1} &, data], {1, -1, 1000}], PlotStyleRed] ;

[Graphics:HTMLFiles/AptitudeTest_58.gif]

The solution to the problem is then the first position greater than the first at which data equals 0:

Position[data, 0]//Flatten

{1, 199981, 199982, 199983, 199984, 199985, 199986, 199987, 199988, 199989, 199990, 200000, 200001}

which are the first few terms of sequence A014778 in the On-Line Encyclopedia of Integer Sequences.

Checking by hand confirms that the numbers from 1 to 199981 contain a total of 199981 1s:

IntegerDigits/@Range[199981]//Flatten//Count[#, 1] &

199981

18.  What is the coolest hack you've ever written?

While there is no "correct" answer, a nice hack for solving the first problem in the SIAM hundred-dollar, hundred-digit challenge can be achieved by converting the limit into the strongly divergent series:

Sum[(-1)^k (2k)^(2k - 1), {k, ∞}]

and then using Mathematica's numerical function SequenceLimit to trivially get the correct answer (to six digits),

Off[SequenceLimit :: "seqlim"] SequenceLimit[FoldList[Plus, 0, N[#, 1000] & @ Table[-(-1)^k (2k)^(2k - 1), {k, 300}]], WynnDegree20]

0.323368

You must tweak parameters a bit or write your own sequence limit to get all 10 digits.

[Other hacks are left to the reader.]

19. 'Tis known in refined company, that choosing K things out of N can be done in ways as many as choosing N minus K from N: I pick K, you the remaining.

This simply states the binomial coefficient identity (N)  (N    )   K            N - K.  

Find though a cooler bijection, where you show a knack uncanny, of making your choices contain all K of mine.  Oh, for pedantry: let K be no more than half N.

'Tis more problematic to disentangle semantic meaning precise from the this paragraph of verbiage peculiar.

20. What number comes next in the sequence: 10, 9, 60, 90, 70, 66, ?

    A) 96
    B) 1000000000000000000000000000000000\
         0000000000000000000000000000000000\
         000000000000000000000000000000000
    C) Either of the above
    D) None of the above

This can be looked up and found to be sequence A052196 in the On-Line Encyclopedia of Integer Sequences, which gives the largest positive integer whose English name has n letters.  For example, the first few terms are ten, nine, sixty, ninety, seventy, sixty-six, ninety-six, ….  A more correct sequence might be ten, nine, sixty, googol, seventy, sixty-six, ninety-six, googolplex.  And also note, incidentally, that the correct spelling of the mathematical term "googol" differs from the name of the company that made up this aptitude test.

The first few can be computed using the NumberName function in Eric Weisstein's MathWorld packages:

<<MathWorld`IntegerSequences`

pairs = Last/@Split[Sort[{StringLength[StringReplace[NumberName[#], {" "->"", "-"->""}]], #} &/@Range[100]], #1[[1]] == #2[[1]] &]

{{3, 10}, {4, 9}, {5, 60}, {6, 90}, {7, 70}, {8, 66}, {9, 96}, {10, 100}, {11, 98}, {12, 78}}

Last/@Take[pairs, 7]

{10, 9, 60, 90, 70, 66, 96}

A mathematical solution could also be found by fitting a Lagrange interpolating polynomial to the six known terms and extrapolating:

pts = {10, 9, 60, 90, 70, 66} ;

newpts = Function[x, Evaluate[InterpolatingPolynomial[pts, x]]]/@Range[7]

{10, 9, 60, 90, 70, 66, 290}

Plot[Evaluate[InterpolatingPolynomial[pts, x]], {x, 0, 7}, PlotStyleRed, Epilog {Red, PointSize[.02], Point/@Transpose[{Range[7], newpts}]}] ;

[Graphics:HTMLFiles/AptitudeTest_76.gif]

21. In 29 words or fewer, describe what you would strive to accomplish if you worked at Google Labs.

[This exercise is left to the reader.]

References

Eustace, A. Google Blog. "Pencils Down, People." Sept. 30, 2004.
http://www.google.com/googleblog/2004/09/pencils-down-people.html

Googler, A. Google Blog. "Warning: We Brake for Number Theory." July 12, 2004.
http://www.google.com/googleblog/2004/07/warning-we-brake-for-number-theory.html

Pegg, E. Jr. "Material Added 13 Jul 2004."
http://www.mathpuzzle.com



[참조]
http://mathworld.wolfram.com/news/2004-10-13/google/

http://snaiper.tistory.com/208

반응형
posted by choiwonwoo
:
Server Development 2007. 11. 13. 22:42
반응형

1.Windows I/O Model이란?
Windows OS에서 입출력 장치(프린터,network card,disk,tape 등)와 대화하기 위한 방법들을 말한다.

2.socket을 위한 I/O Model의 종류?
여기서는 서버를 개발하는 가장 중요한 Socket을 위한 I/O Model을 살펴볼것이다.




2.1 WSAAyncSelect
장점 : 사용하기 쉽다.





<그림 1> 비 Overlapped I/O 처리
Network/Non-Overlapped.gif



<그림 2> Overlapped I/O 처리
Network/Overlapped.gif
반응형
posted by choiwonwoo
:
Server Development 2007. 11. 13. 22:30
반응형
클래스 설계시 부모클래스와 자식클래스의 인터페이스(선언)과 정의부의 상속에 따라 인터페이스를 다르게 설계해야 합니다.

순수가상함수 virtual void draw() = 0;
가상함수 virtual void error(const std::string& message);
비가상함수 virtual void objectID();

위와 같이 사용을 하게 되는데 결론 부터 이야기 하자면,

1.순수 가상함수는 인터페이스의 상속만을 허용합니다.

순 수 가상함수의 특징은 크게 2가지 입니다. 첫째 어떤 순수 가상 함수를 물려 받은 하위 클래스에서 해당 순수 가상 함수를 반드시! 다시 선언해야 합니다. 순수 가상 함수의 두 번째 특징으로는 부모클래스에서 정의를 갖지 않습니다. 팀 단위 프로젝트에서 "반드시 이 클래스는 그리는 매서드를 지녀야해. 어떻게 그릴지는 차후에 당신이 생각하세요" 라고 설계자가 말하는 것이 됩니다.

2.가상함수는 인터페이스의 상속과 기본 구현의 상속도 가능하도록 지정합니다.
가상함수는 순수가상함수처럼 인터페이스를 상속하게 한다는 점은 같지만 하위 클래스에서 오버라이드(재정의)할 수 있는 구현부도 제공한다는 점이 다릅니다.
가상함수를 만들 설계자가 "error함수는 여러분이 지원해야 한다우. 그러나 굳이 새로 만들 생각이 없다면 추상클래스의 기본버젼을 사용하쇼."  라고 말하는 것입니다. 이는 다소 위험 할 수 있습니다. 코드의 유지/보수 시에 이전에는 필요하지 않던 인터페이스의 재정의 시에 나타납니다. 즉 추후에 추가된 기능을 넣어야 하는데 이를 잊고 그대로 사용하는데도 컴파일러는 아무런 문제를 일으키지 않기 때문입니다.

3.비가상 함수는 인터페이스 상속과 필수 구현의 상속도 가능하도록 하는 것입니다.
설계자는 "추상클래스에 파생된 모든 객체의 식별자를 나타내는 ID가 필요한데 이것을 계산하는 방법은 항상 똑같아"
라고 말하는 것입니다.

지금까지는 추상클래스라고 하더라도 모든 멤버를 비가상함수로 선언했었습니다. 비가상소멸자가 문제를 일으키기도 합니다. 그러니깐 이런것을 잘 알고 사용합시다.
반응형
posted by choiwonwoo
:
추천장소 2007. 11. 12. 00:00
반응형

소중한 사람이 알려줘서 알게 된곳이다.
자리마다 내부공간이 좋은게 아쉽지만, 서로 단둘이 집중할수 있는 공간이 잘 구성되어 있다.

http://www.candle1978.com/main.htm 

반응형
posted by choiwonwoo
:
etc 2007. 11. 11. 16:08
반응형

컴퓨터를 사용하다 보면 PC의 시간이 조금씩 느려지거나, CMOS Battery 방전으로 인하여 시간이 불일치하게 된다. 이럴때는 아래와 같은 방법을 취하면 된다.


1.  제어판 ==> 날짜및 시간 ==> 인터넷 시간 선택하고, 시간을 업데이트 한다.
    이방법에서 에러가 나온다면, cmos등 다른 문제일 확률이 높다. 그렇다면 아래의 방법으로 하면 된다.

2. 한국표준과학연구소(http://www.kriss.re.kr/time)에서 배포하는 TimeSyncPG(P/G명:UTCK를 다운)을 다운 받고, 설치하고, 동기화 한다. 그리고 매번 컴퓨터가 기동될때마다 시작되게 하려면, 프로그램을 시작 프로그래밍 등록한다.(ex:msconfig)
    




반응형
posted by choiwonwoo
:
Investment Info 2007. 11. 8. 01:25
반응형
금융감독원 : http://dart.fss.or.kr/ ==> 100대기업 안으로 우량주 우선 그리고 저평가된 기업을
반응형
posted by choiwonwoo
:
추천장소 2007. 11. 3. 12:55
반응형

이전에 업무적으로 여의도를  들락 날락하다..어쩌다 알게 되었던 곳이다.
개인적으로 가장 중요시 하는 가격대 성능비가 매우 우수하고, 전망이 탁트여서 마치 야외같다.

며칠전 오랜만에 다시 찾았다...역시...하는 생각이 든다.

한번들 꼭 갔다오심도...

http://www.cafeiou.co.kr/

반응형
posted by choiwonwoo
:
Server Development 2007. 10. 31. 22:33
반응형
어느덧 제가 벌써 횟수로 조금 있으면 경력이 두자리숫자가 되어가네요.
그 숫자 중에 약 70%는 Server Side 개발( 보안/인증서버, 인터넷뱅킹서버,빌링 서버,게임서비스 관련 서버등)을 주로 하였습니다.

그리고 스스로 자랑할만한 Output을 가지고 있다고 자부하고,특히 Unix(Linux) 와 윈도우 모두에서 Server Application(금융권과 게임회사에서 서비스중)을 개발하면서 국내 최대 처리량과 동접을 처리하면서 느낀점을 공유하고, 뒤에오시는 후배님들이 차근 차근 접근하기 좋게 정리하고자 합니다.
반응형
posted by choiwonwoo
: