Showing posts with label HandNote. Show all posts
Showing posts with label HandNote. Show all posts

2008-03-11

Learn From Your Previous Mistakes

The Well-Known Definition Of Insanity Is Doing The Same Thing In The Same Way And Expecting Different Results. But Repeating A Failure Is Not Only A Sign Of Insanity, It Is A Refusal To Admit You May Not Be Perfect. To Have The Emotional Maturity To First Admit You Made A Mistake, Then To Determine What The Mistake Was And Thirdly To Take Steps To Correct That Mistake For The Next Time Shows That You've Grown Beyond Infancy. One Final Step In Learning From Your Previous Mistakes Is Realizing That There May Not Be Any Way To Correct The Mistake You've Made And To Be Able To Move Beyond It.
There Are At Least Four Different Types Of Mistakes And What You Learn From Them May Depend On Your
Maturity As Well As The Type Of Mistake You Made.
The First Type Of Mistake Is The
Dumb Mistake. This Is The Mistake Of Tripping On The Sidewalk Or Touching Wet Paint. This Is The Child Running From A Promised Spanking And Hiding Under The Bed. About The Only Lessons Which Can Be Learned From A Dumb Mistake Is That It Was Dumb To Do It, But That Doesn't Mean It Will Never Happen Again Or That You've Learned Anything From The Mistake. After All, There Will Always Be Rough Spots On The Sidewalk And We Always Have That Uncontrollable Urge To See If The “Wet Paint” Sign Is Right.
Mistake Number Two Is The Simple Mistake. This Is The Mistake Where You Call Your Wife By Your Secretary's Name, Or You Forget To Mail The Letter With The Rent Check. If Something Like This Happens
Regularly, Or If It Becomes An Issue Between Yourself And Your Spouse, You Probably Need To Find A Way To Remember Errands And Names. If It's Simply A Lack Of Focus, It's Probably Best Not To Stress Out About It. You Can Learn From This Type Of Mistake That You Can Be Better Organized Or That You May Need To Learn Some Memory Techniques.
The Third Type Of Mistake Is A Little More
Serious. This Is The Dumb Mistake Or The Simple Mistake Repeated Over And Over With Either No Understanding That It Is A Mistake, Or No Understanding Of How To Change And Learn From The Mistake So As To Get Different Results The Next Time. This Kind Of Mistake Is Known As The Serious Mistake. This Mistake Is One That Could And Should Result In A Change Of Thinking. If You Lose Your Job Because You Are Habitually Late For Work, You Can Refuse To Accept The Responsibility For The Mistake And Refuse To Change, Or You Can Continue To Be The Emotionally Immature Child Who Can't Learn From A Mistake Because They Don't Understand That A Mistake Has Been Made. Either That Or They Blame The Boss For Firing Them.
The Fourth Type Of Mistake Is The Most Interesting, And Also The One From You Have The Most Opportunity To Learn. This Is The Complex Mistake. It May Be The Mistake That Was Unavoidable Given All The Sequence Of Events Which Led Up To The Error. This Is Where The Learning Comes In. By
Analyzing The Causes, Timing, Personalities And Nature Of The Mistake, You May Recognize That The Mistake Was Simply Unavoidable, But You Might Also Be Able To Use That Information To React Differently During The Process And Thereby Reach A Different Result.

One Kind Of Journey Named Life

The Life Seems A Package, In This Package Is Hiding Joyful And Sad, Successful And The Defeat, Hoped That With Despairs. The Life Is Also A Study Process. These Experiences For Us On The Brand-New Class, Have Let Us Become Better. Along With Each Day-Long Past, We Learned To Deal With Various Issues .
The Life Is A Travel Analogy Is Appropriate, Therefore Often The Human Said That Now The Success Or Failure Success And Failure Is The Eye Mist .
Just Like An Advertisement Said Such : Life Is Like A Journey, It Does Not Matter Where Your Destination Is; What Matters Is The Way You Take, And How You Take Your Way.

AD :


LiQun - Lets The Mind Travel ~

HeHe ... Has Some Feelings .

2008-01-13

Distance

Sometimes The Walked Is Nearer , But The Distance Is Farther ... ...

2008-01-09

Interesting Decode

main(_){ for ( --_ ; putchar( _++["J!Mpwf!Zpv\1"] - 1 ) ; ) ; }

Program : Prints "I Love You"
//Not Including The Quotation Marks
//File Name : xx.c
//Programming Language : C
//Author : Unknown
//This Program Simply Prints "I Love You" And Exits.

This Lets Me Remember A Story Of About Mathematics : Mathematician Descartes In Writes Letter For Sweden Princess Christina , Has Only A Formula " R=A(1-Sinθ) " .
He-He , With Polar Coordinate System A Beautiful Heart Shape Line .
It's A Good Idea .

2008-01-06

About Strcpy

Realizes Strcpy () Function , Didn't Use C++ Library , Compile With Self .

char * strcpy(char * strdesc,char * strsrc)
{
char *p ;
if(strsrc == NULL)
exit ;
if(strdesc == strsrc)
return strdesc ;
p = strdesc ;
while( *strsrc == '\0')
*strdesc++ = *strsrc++ ;
return p ;
}

In 《High Quality C / C++ Programming Guide》
LinRui's Answer:

char *strcpy(char *strDest, const char *strSrc);
{
assert((strDest!=NULL) && (strSrc !=NULL)); // 2 Points
char *address = strDest; // 2 Points
while( (*strDest++ = * strSrc++) != ‘\0’ ) // 2 Points
NULL ;
return address ; // 2 Points
}

2007-12-30

About SSCANF

Keywords: %[a-z] SSCANF Delimit
Before Long Time Ago, I Thought C Not Itself Split String Function,Afterward I Have Discovered SSCANF; Since Continuously, I Thought That SSCANF Can Only Limit The String Of Character By The Blank Space, Now I Found That I Was Wrong.

SSCANF Is When A Movement Function, The Primary Form Is Very Simple:int sscanf(const char *buffer,const char *format [,argument ] ... );
Its Formidable Function Manifests To Format In The Support .

#include < iostream >
#include "stdio.h"
#include "string.h"
using namespace std;
int main( )
{
char ip[20];
char *p;
int port;
char * strip="192.0.168.1:8080";
sscanf(strip.c_str(),"%s:%d",&ip[0],&port );
p = strstr( ip, ":"); //Would Not Search ":" Here ?
*p = 0;
cout << ip << endl;
cout << port << endl;
// printf("%s\n",ip);
}

But In This Example,WHy Must Find ":" In String ? Otherwise Cannot Split String Or Output Error .

2007-12-21

A Small Test Program

/**************************************************************
Function:ReadIniFile (Read File Type Of Ini)
Usage:ReadIniFile ( )
An independent function, mainly uses in to read the ini files
IniFileForm:
===============================================================
[Section]
Key=Value
[Section1]
Key1=Value1
[Section2]
Key2=Value2
[Section3]
Key3=Value3
[Section4]
Key4=Value4
...
===============================================================
DevelopmentEnvironment:Linux
Author:顜禜 Date:Dec,19th,2007
***************************************************************/
#include "stdio.h"
#include "glib.h"
#include "glib/gkeyfile.h"
#include < vector >
#include "string.h"
#include "iostream"

int g_size;

/*Define a vector to load datd in it,and then use it in whole project*/
using namespace std;
vector< string > vecBTCIP;
vector< string > vecClientIPRange;
vector< string > vecLevel0;
vector< string > vecLevel1;
vector< string > vecLevel2;
/*Why in here must use "string" type?*/

int ReadIniFile(const char *filename) //Use Glib to read file
{
GError *error = NULL;
GKeyFile *key_file=g_key_file_new();

if (!g_key_file_load_from_file(key_file,filename,G_KEY_FILE_NONE,&error)) //Load File
{
printf("cannot load %s",filename);
return 1;
}
else
{
printf("load %s\n",filename,"\n");
}
g_key_file_set_list_separator(key_file,';');
int Cnt=(int)g_key_file_get_integer(key_file,"Section","Key",&error);
char *Caddr=(char *)g_key_file_get_string(key_file,"Section1","Key1",&error);
char *BTCIP=(char *)g_key_file_get_string(key_file,"Section2","Key2",&error);
gsize *length; //String list length
char** Level=(char **)g_key_file_get_string_list(key_file,"Section3","Key3",&length,NULL);
char** Level1=(char **)g_key_file_get_string_list(key_file,"Section4","Key4",&length,NULL);
char** Level2=(char **)g_key_file_get_string_list(key_file,"Section5","Key5",&length,NULL);
char** Level3=(char **)g_key_file_get_string_list(key_file,"Section6","Key6",&length,NULL);

/*printf("Cnt:%d\n",Cnt,"\n");
printf("Caddr:%s\n",Caddr,"\n");
printf("BTCIP:%s\n",BTCIP,"\n");
printf("Level:%s\n",*Level,"\n");
printf("Level1:%s\n",*Level1,"\n");
printf("Level2:%s\n",*Level2,"\n");
printf("Level3:%s\n",*Level3,"\n");*/

vecBTCIP.push_back( BTCIP);
vecClientIPRange.push_back(Caddr);
vecLevel0.push_back(*Level);
vecLevel1.push_back(*Level1);
vecLevel2.push_back(*Level2);

//cout < < vecLevel2.at(0) < < endl; //Test Taking Value

g_key_file_free(key_file);
}
int main ()
{
ReadIniFile("Filename"); //Ini Filename
}


Why In Here Vector Cannot Use Char Type,Use It Would Appear Compilation Error?
Thinking And Searching This Question.