Saturday, October 24, 2009

Memory dump in the Visual Studio 2005

If you want to watch memory dump in the Visual Studio 2005,

In the debug mode,
Press debug menu icon
listed memu > Breakpoints, Output, ...
Click Memory

Memory dump window added in the Visula Sutdio 2005.

YAFFS

Linux File System
YAFFS (Yet Another Flash File System)

Android file system is YAFFS.
& List of File Systems

Wednesday, October 21, 2009

stack, heap, and bss ...

In the programming, excution file (.exe or .bin) is consist of below structure.

1. Text (code) segment

2. Data segment
2.1 Initialized Data
2.1.1 Initialized read only Data
2.1.2 Initialized read/write Data
2.2 Uninitialized (bss: Block Started by Symbol)
3. Heap segment (in the run time, size is decided)
Dynamic allocated variables
4. Stack segment (in the compile time, size is decided)
Automatically allocated variables (local variables) and other stack frame entries

Binary or Excution file is "Text + Initialized Segment".


Graphically description is

/-------------------------/ High Address (Memory Address)
| |
| Stack |
| |
/-------------------------/
| |
| Heap |
| |
/-------------------------/
| Uninitialized data |
| ---------Data---------- |
| Initialized data |
/-------------------------/
| |
| Text |
| |
/-------------------------/ Low Address (Memory Address)

http://kldp.org/node/199#comment-461
Data Segment
BSS

Thursday, October 8, 2009

Profile or Profiling in Visual C++ 6.0

If you want to optimize source code in Visual C++ 6.0, You can ues the function "Profile".

How can you use this fuction, "Profile"?

1. Project > Settings > Link
Check: Enable profileing and Generate Map file
2. Build > Rebuild All
3. Build > Profile
function coverage
function timming
mix
custom mode
4. Profiling ...
5. After terminating, stop Profiling.
6. And then, display profile infomation

Enable Profiling

SDET

SDET: Software Design Engineer in Test
Tests and critiques software components and interfaces in more technical depth, writes test programs to assure quality, and develops test tools to increase effectiveness.

http://en.wikipedia.org/wiki/Sdet
http://microsoftjobsblog.com/
Microsoft software development engineer in test (SDET) interview questions

Sunday, July 12, 2009

Do you know "Wonder Girls"?

Today from the Internet, I saw Wonder Girls' interview,
Today I saw one of success of World Wide Korean Entertainment.
English is the if and only if tool to go to international world.

Outliers: The Story of Success

I read a book, "Outliers: The Story of Success".
Wow, Malcolm Gladwell, he is a great man.
From the Internet there are many resource

This year I read two great books
One is a Code Complete, and another is a Outliers.

Tuesday, June 2, 2009

The Power of Detail

I read the book "The Power Of Detail"
Usually, nowadays I read books which was written U.S. writers or Korean writers. But this book was written by Chinese person and the point of views are very different, in my case.
The world is wide and there are many things happen in the world.

Wednesday, May 6, 2009

Code Complete 3, Etc

1. Pragmatic Programmer (Hunt and Thamas 2000)
2. Jon Bentley, Programming Pearls, 2nd ed. (Bentley 2000)
3. Kent Beck, Exteme Programming Explained: Embrace Change (Beck 2000)
4. Steve Maguire, Writing Solid Code - Microsoft's Techniques for Developing Bug-Free C Software (maguire 1993)
5. The Practice of Programming, by Brian Kernighan and Rob Pike (Kernighan and Pike 1999)

Code Complete 2, Daily Build, Smoke Test, and Tools

Daily Build, Smoke Test, and Tools
In your project,
1. "do you have 'daily build' system?"
And 2. "do you use 'Smoke Test'?"

Tools
1. www.sdmagazine.com/jolts
2. Hunt, Andrew and David Thomas. The Pragmatic Programmer. Boston. MA: Addison-Wesley, 2000
3. Vaughn-Nichols, Steven. "Building Better Software with Better Tools." IEEE Computer, September 2003, pp. 12.14
4. Glass, Robert L. Software Conflict: Essays on the Art and Science of Software Engineering. Englewood Cliffs, NJ: Yourdon Press, 1991
5. Jones, Capers, Estimating Software Coast. New York, NY: McGraw-Hill, 1998
Boehm, Barry, et al. Software Cost Estimation with Costs II. Reading, MA: Addison-Wesley, 2000

Monday, May 4, 2009

Wish list of books

Wish list of books.
How many books can I read in this year?
The number is the wish order of reading.

4. The Psychology of Computer Programming,
by Gerald M. Weinberg (프로그래밍 심리학)
1. The Practice of Programming,
by Brian W. Kernighan and Rob Pike. (프로그래밍 수련법)
Programming Challenges,
by Steven S. Skiena, Miguel Revilla (프로그래머 두뇌 단련 퍼즐 44제)
2. The Pragmatic Programmer,
by Andrew Hunt, David Thomas (실용주의 프로그래머)
My Job Went to India: 52 Ways to Save Your Job,
by Chad Fowler (사랑하지 않으면 떠나라)
3. 겸손한 개발자가 만든 거만한 소프트웨어,
by
5. ship it,
by Jared Richardson, Will Gwaltney, Jr
0. 디테일의 힘,
by 왕중추

Monday, April 13, 2009

In the pipe five by five

- One by one,
- Two by two,
- Five by five.

The famous saying is

1. "In the pipe five by five." you can hear this word in the game "Starcraft". but the original word in the movie "Aliens". "We're in the pipe, five by five."

2. In the bible, we can find "Noah brought all animals into the ark two by two"

Anything else?

Sunday, April 12, 2009

Code Complete 1, in the floating point

Thin book is a great, wonderful, and fantastic.
How can he write this book, is he a genious?

In the floating point operation,

double dwNormal = 1.0;
double dwSum = 0;

int i = 0;
for (i=0; i<10; i++)
{
dwSum += 0.1;
TRACE("dwSum: %1.20f\n", dwSum);
}

if (dwSum == dwNormal)
{
TRACE("Numbers are the Same.");
}
else
{
TRACE("Numbers are Differnet.");
}

Can you guess the result?
dwSum == dwNormal is True or False?
In normal case, the result is False.
dwSum = 0.99999999999999989
In normal case, floating point precision, usually be represented to only 7 ot 15 digits of accuracy.

dwSum: 0.10000000000000001000
dwSum: 0.20000000000000001000
dwSum: 0.30000000000000004000
dwSum: 0.40000000000000002000
dwSum: 0.50000000000000000000
dwSum: 0.59999999999999998000
dwSum: 0.69999999999999996000
dwSum: 0.79999999999999993000
dwSum: 0.89999999999999991000
dwSum: 0.99999999999999989000

C code refactoring

refactoring & restructuring

refactoring is same input and output of function arguments
just change into the function's code

restructuring is same input and output of function argument or NOT.
In the project middle term, refactoring and/or restructuring
End of project, restructuring is NOT recommended, restructuring is recommended.

Saturday, March 28, 2009

Video Clips

Nowadays in the Internet  we can download many video clips.
About 10 years ago, was it possible? In 1994 or 1995, at the university I downloaded many video clips from Broadcast companies or BBS. At that time I could not think, nowadays famous service, video clip streaming service. If I were known that service ...
So nowadays, through those service, I can watch many video clips such as Music video, TV show, Japan animation, and etc. Now it is related copyright, but it is possible ;-).

And more important information is,
I get more knowledge, I want to watch more video clips.

Nowadays, I like "Girl's generation".

Sunday, February 22, 2009

display calculation result, long expression

In the C code, if the input value is very large and include fraction expression,
for example 3.141592 or 6350.29318. And want to display those values exactly.
How can you deal those values?

Now, I'm thinking, I use value shift and divide integer part and decimal part.
 3.141592 = 3 + 0.141592
 6350.29318 = 6350 + 0.29318

In the C language
 First, multiply big or large number
 6350.29318 * E14 = 635029318000000000
 and divide that value 6350 & 29318
 and check the decimal point, i.e., 5
 Second, use the sprintf(...) function
  such as "sprintf(SzTestResult, "%d.%0*d", lInteger, nDecimalPoint, lDecimal);"

And my question is, if there is or are  the C language exporter(s), how he or they deal(s) this issue?


#include
#define SHIFT_SIZE_MAX (14)
#define NUMBER_SHIFT(X) ((X)*pow(10, (SHIFT_SIZE_MAX)))

// ------------------------------------------------------------------------------
// NumberFraction
// Input
//  dInputNumber: Real Number, ABC.DEF
//  *plNaturalNumber: Value of Natural Numner, ABC
//  *plDecimalNumber: Value of Decimal Number, DEF
//  *pnDecimalPoint: Value of Decimal Point, 3
// Return
//  Success: 0
//  Fail: NOT 0
// ------------------------------------------------------------------------------
int NumberFraction(
double dInputNumber, 
unsigned long *plNaturalNumber,
unsigned long *plDecimalNumber,
int *pnDecimalPoint)
{
int nReturnType = 0;

// Input Value
//double dInputNumber = 6350.29318;

// Return Value 
unsigned long lNaturalNumber = 0;
unsigned long lDecimalNumber = 0;
double dDecimalNumberT = 0;
//int nDecimalPoint = 0;

double dShiftedValue = dInputNumber * pow(10, SHIFT_SIZE_MAX);

//  Count Deciaml Number
int nCount = 0;
int nDecimalNumber = 0;
double dInputValue = dShiftedValue;

// Check Input Value
if (plNaturalNumber == NULL)
{
return nReturnType = 2;
}

if (plNaturalNumber == NULL)
{
return nReturnType = 3;
}

if (pnDecimalPoint == NULL)
{
return nReturnType = 4;
}

for(nCount=0; nCount
{
double dVal = 0;
double dFraction = 0;

dInputValue = dInputValue / 10.;

dFraction = modf(dInputValue, &dVal);
if (dFraction == 0.0)
{
continue;
}
else
{
break;
}
}
nDecimalNumber = SHIFT_SIZE_MAX - nCount;

lNaturalNumber = (unsigned long)(dShiftedValue / pow(10, SHIFT_SIZE_MAX));
dDecimalNumberT = dShiftedValue  - (lNaturalNumber * pow(10, SHIFT_SIZE_MAX));
lDecimalNumber = (unsigned long)(dDecimalNumberT / pow(10, nCount));

// Set Return Value
*plNaturalNumber = lNaturalNumber;
*plDecimalNumber = lDecimalNumber;
*pnDecimalPoint = nDecimalNumber;

return nReturnType;
}

// ------------------------------------------------------------------------------
// NumberFraction2String
// Input
//  dInputNumber: Real Number, ABC.DEF
//  pOutputString: "ABC.DEF"
//  nOutputStringSize: SHOULD 32 bytes or more
// Return
//  Success: 0
//  Fail: NOT 0
// ------------------------------------------------------------------------------
int NumberFraction2String(
double dInputNumber, 
char* pOutputString, 
int nOutputStringSize)
{
int nReturnType = 0;

char SzTestResult[32] = {0x00, }; 
char SzZeroString[16] = {0x00, };
char SzDecimalNumber[16] = {0x00, };
int nMaxZeroNumber = 0;

int i = 0;

unsigned long lInteger = 0;
unsigned long lDecimal = 0;
int nDecimalPoint = 0;

// Check Input Value
if (pOutputString == NULL)
{
nReturnType = 2;
}

// memset
memset(pOutputString, 0x00, nOutputStringSize*sizeof(char));

// Convert: InputNumber Fraction, NatualNumber + DecimalNumber
nReturnType = NumberFraction(dInputNumber, &lInteger, &lDecimal, &nDecimalPoint);
if (nReturnType == 0)
{
int nStringSize = 0;

#if 0 // OLD Method
sprintf(SzDecimalNumber, "%d", lDecimal);
nMaxZeroNumber = nDecimalPoint - strlen(SzDecimalNumber);
for (i=0; i
{
SzZeroString[i] = '0';
}
sprintf(SzTestResult, "%d.%s%d", lInteger, SzZeroString, lDecimal);
#else // NEW Method
sprintf(SzTestResult, "%d.%0*d", lInteger, nDecimalPoint, lDecimal);
#endif //
nStringSize = strlen(SzTestResult);

if (nOutputStringSize+1 >= nStringSize)
{
memcpy(pOutputString, SzTestResult, nStringSize*sizeof(char));
}
}
else
{
// error
nReturnType = nReturnType + 10;
}

return nReturnType;
}

// Test Code
//double dTest = 3280.8399;
//double dTest = 0.0000000009842;
double dTest = 1.01660469088;
char SzOutputBuffer[32] = {0x00, };
int nOutputBufferSize = 32;
NumberFraction2String(dTest, SzOutputBuffer, nOutputBufferSize);


Friday, February 20, 2009

::ShellExecute

Previous time, I used "WinExec(...)" function to execute windows application.
But other persion use the other windows API to execute windows application instead of "WinExec(...)". That function name is "ShellExecute(...)".

If you want to open web site (www.google.com) with internet explorer, you can write code as followed
 ::ShellExecute(
     NULL, 
     L"open", 
     L"http://www.google.com", 
     L"", 
     NULL, 
     SW_SHOWNORMAL);
But if you want open NEW web site in the NEW internet explorer, you can write code as followed
 ::ShellExecute(
     NULL, 
     L"open", 
     L"iexplore.exe", 
     L"http://www.apple.com", 
     NULL, 
     SW_SHOWNORMAL); 


How to build UNICODE in the Visual C++ 6.0

In the Visual C++ 6.0, if you want to compile UNICODE code,
You should chagne some configuration.

1. in the project, you delete _MBCS and input _UNICODE.
 [Project] -> [Settings] -> [C/C++ tab] -> [General Category]
  in the Preprocessor definitions, change _MBCS to _UNICODE
2. If you meet "Cannot open MFC42ud.dll(mfc42u.lib, mfcs42d.lib, or etc)"
 Copy the MFC library to your local machine. 
 From CD \VC98\MFC\LIB\all files to \Microsoft Visual Studio\VC98\MFC\Lib\ directory
3. [Project] -> [Settings] -> [Link] 
 In the Object/libary modules, insert mfc42u.lib
And compile the source code.

If you will see "msvctl.lib:error LNK2001 :unresolved external symbol _WinMain@16~~~"
 [Project] -> [Settings] -> [Link] 
 In the Entry-point symbol set "wWinMainCRTStartup"

That's all.

Sunday, February 8, 2009

Helvetica

Documentary Helvetica

Helvetica A Documentary Film by Gary Hustwit
Helvetica Movie Clip

Wednesday, February 4, 2009

About Japanese animation

Nowadays I watched 2 animations ("anime" or "manga").

Time of Eve (イヴの時間)

Voices of a Distant Star (ほしのこえ)

Japanese animations have variety living thing, i.e. they treat many subject matters which I never think about before. In this reason I like "anime". And I want to learn Japanese.
Do you like Japanese animation?

Monday, February 2, 2009

Flash based web search engines

Flash based web search engines


1. Search engine with a touch of humor that plays prerecorded movie clips of a female actress to entertain you while searches are being performed:
2. Search for the most current political topics and election information at leftvsright.com. Stay informed on the presidential race, nominations, poll numbers, candidates and more:
3. Blinkx - World's largest video search engine. Search over 32 million hours of video from sites like Google Video, YouTube, MySpace, MetaCafe, and more:
4. Cannot access this site : 
5. RedZee is the result of many years of brain-storming sessions that aimed to create a search engine that will revolutionize search. Conventional search engines use text as the main focus of their results, only bringing back 10 results ... :
6. Preview web search results, watch videos, listen to music, find images, review news and find great shopping deals : 

Thursday, January 22, 2009

If you want to add time log in the code ...

PBSearchingTimeMS = \
(unsigned long)((PBSearchingTimeTickEnd - PBSearchingTimeTickStart) / 32.768);

* change clock (frequency) to time: 32.768 (Crystal Clock)

Custom Token Macro in Source Insight

We suppose,
When you use the "Source Insight" as your source code editor,

Source code is as followed

 #define PACKED __packed
 typedef PACKED struct {
  int age;
  int tall;
 } MyStyleType;

Source Insight cannot parsing the variable "MyStyleType".

How can you fix it?
Source Insight support "*.tom" file.
In this case, we can change or add "c.tom"
c.tom file in the MyDocument\Source Insight\C.tom

We can add some key words,
_packed
packed
PACKED

That's all.

Sunday, January 18, 2009

How to define "printf(...)" to "DEBUG(...)" in C/C++

When you make a program or programs, you need to check the program running condition.
In this reason, you want to use the debug message into the program.
In the debugging time you use the print put the logging messages and in the release time you don't want to use the logging messages.
When you use the macro "#define" how can you convert printf(char* format, ...) function to macro function?

As following,

// Multiple arguments
#define MSG_ERR(format, ...)    TRACE(ERROR, format, __VA_ARGS__)
#define MSG_WARN(format, ...)   TRACE(WARNING, format, __VA_ARGS__)
#define MSG_HIGH(format, ...)   TRACE(HIGH, format, __VA_ARGS__)
#define MSG_MID(format, ...)    TRACE(MIDDLE, format, __VA_ARGS__)
#define MSG_LOW(format, ...)    TRACE(LOW, format, __VA_ARGS__)
// Single argument
#define MSG_ERR(format)        TRACE(ERROR, format)
#define MSG_WARN(format)       TRACE(WARNING, format)
#define MSG_HIGH(format)       TRACE(HIGH, format)
#define MSG_MID(format)        TRACE(MIDDLE, format)
#define MSG_LOW(format)        TRACE(LOW, format)

And get more things, please refer to
Support for variadic macros was introduced in Visual C++ 2005.

Friday, January 16, 2009

About Bit Field in C/C++

In the C/C++, 
usually we use the "Bit Field" to optimize code or communicate with other process.
What is the Bit Filed?

I have attached "Example Code".

Example code

// Test Code, Bit Field
// ----------------------------------
{
 #define u8 unsigned char

 #define FILL_STRUCT1 u8:0; u8:8; u8:0;
 #define FILL_STRUCT2 u8:0; u8:8; u8:8; u8:0;
 #define FILL_STRUCT3 u8:0; u8:8; u8:8; u8:8; u8:0;

 typedef struct tag_SIMCommand {
 u8 Class;
 u8 Instruction;
 u8 P1;
 u8 P2;
 u8 P3;
 FILL_STRUCT3 // Bit Field
 u8 CData[8];
 } SIMCommandType;

 SIMCommandType SIMCommand;

 memset(&SIMCommand, 0xFF, sizeof(SIMCommandType));
 memset(&SIMCommand, 0x00, sizeof(SIMCommandType));

 // SELECT
 SIMCommand.Class = 0xA0;
 SIMCommand.Instruction = 0xA4;
 SIMCommand.P1 = 0x00;
 SIMCommand.P2 = 0x00;
 SIMCommand.P3 = 0x02;
 memset(SIMCommand.CData, 0xFF, sizeof(u8)*8);
}
// ----------------------------------

// Real Memory, Dump 1
// ----------------------------------
0012F3B0  A0 A4 00 00  
0012F3B4  02 00 00 00  
0012F3B8  FF FF FF FF  
0012F3BC  FF FF FF FF  
// ----------------------------------

// Test Code, Bit Field
// ----------------------------------
{
 #define u8 unsigned char

 #define FILL_STRUCT1 u8:0; u8:8; u8:0;
 #define FILL_STRUCT2 u8:0; u8:8; u8:8; u8:0;
 #define FILL_STRUCT3 u8:0; u8:8; u8:8; u8:8; u8:0;

 typedef struct tag_SIMCommand {
 u8 Class:4;
 u8 Instruction:2;
 u8 P1:1;
 FILL_STRUCT1
 u8 P2:4;
 FILL_STRUCT2
 u8 P3:1;
 FILL_STRUCT3 // Bit Field
 u8 CData[8];
 } SIMCommandType;

 SIMCommandType SIMCommand;

 memset(&SIMCommand, 0xFF, sizeof(SIMCommandType));
 memset(&SIMCommand, 0x00, sizeof(SIMCommandType));

 // SELECT
 SIMCommand.Class = 0x0F;
 SIMCommand.Instruction = 0x03;
 SIMCommand.P1 = 0x01;
 SIMCommand.P2 = 0x0F;
 SIMCommand.P3 = 0x01;
 memset(SIMCommand.CData, 0xFF, sizeof(u8)*8);
}
// ----------------------------------

// Real Memory, Dump 2
// ----------------------------------
0012F39C  7F 00 0F 00  
0012F3A0  00 01 00 00  
0012F3A4  00 FF FF FF  
0012F3A8  FF FF FF FF  
0012F3AC  FF CC CC CC  
// ----------------------------------

If you have any question? Please let me know :-)

Sunday, January 4, 2009

Soap opera, TV Drama?

Nowadays I am watching TV series
Grey's Anatomy: Season 1, 2, 3, 4, and 5
 now, I am watching season 2.

Previous time, I watched
LOST: Season 1, 2, 3, 4, and 5
 I already watched season 1, 2, and 3.
HEROES: Season 1, 2, and 3
 I already watched season 1, 2.
and NOW, I'm watching Gray's Anatomy.

Previous time, I have watched 24, Numb3rs, ... 

When I was school student, I have watched many Americana's TV series,
for example MacGyver, Air Wolf, The Wonder Years and so on.

In the future, can I watch these TV series without caption?



Thursday, January 1, 2009

Do you have a dream or a plan?

In the computer algorithm, there is "Divide and Conquer" i.e. when you solve the problem divide the problems and solve each of them. 

Today is the first working day of this year 2009.

Now, I am making this year's decision.

1. Increase family member.
2. Read English written books more than 10.
3. Join the on line lessons more than 10.
4. Upload blog more than 10 every month.

And end of this year, I will check them.

Let's start!

January 2nd, 2009.