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 :-)