Google
 

Tuesday, April 10, 2007

Re: Re: 我们需要怎样的教育

in my opinion,the fear is false,the lazy is real.
we should never be diligent selectively,
but usefully.
seems terrible and uncomforable
but as long as you really regard the bitterness as the pleasure!

as for the educaton,there is too too much about it.
ideological education:
set examples by the elites is just the most important,but anthing left except the corruption?
science education:
i and the most majority of the budies here have lent most of them to our teachers.



> 我的理解是:恐惧不完全是坏事情,恐惧能够提醒我们分辨思考,帮助我们逃避危险。但是当恐惧变成一种巨大的精神负担和无底深渊时,对恐惧的态度是至关重要的:是平和的接受然后思考分析,还是又产生了对当前这种恐惧状态的恐惧,我觉得这是书中探讨的"智慧"-
> "它是一种无限的包容力,允许你自由地思想;没有恐惧,没有公式, 然后你才能发现什么是真实的、正确的事物。
> "如果教育能上升到人性化的教育,现在人们的问题就会少得多了。那教育该由谁来承担呢?我觉得不是一个人、一个家庭、一所学校的责任。我们时时刻刻都在接受教育,也在教育着别人,从自己的生活、工作、自己的家人、朋友、同学、周围所有认识和不认识的,看到的、听到的、想到的、有生命的和没有生命的,每一个都值得我们学习思考。想想那些影响我们生命历程的曾经的陌生人,你就能想象得到我们又是在如何影响别人的生活?过去的都已经过去,不要让过去成为我们成长路上的负担,忘记过去,除了感激什么都不要留下,让我们重新开始吧!
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "Not Waste our youth" group.
> To post to this group, send email to not-waste-our-youth@googlegroups.com
> To unsubscribe from this group, send email to not-waste-our-youth-unsubscribe@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/not-waste-our-youth?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>




===============================================
快来和我一起享受TOM免费邮箱吧! 看看除了1.5G,还有什么?

看看女人都在聊什么? 美图尽赏 聊天世界

明星金曲免费送(http://mm.tom.com/ivr/):周杰伦 林俊杰 庞龙 张惠妹

劲爆歌曲尽情点(http://mm.tom.com/ivr/):霍元甲 吉祥三宝 人质 曹操

炫酷彩铃免费送(http://mm.tom.com/cailing/):周杰伦帮你接电话 麻烦女朋友 七里香 小城故事
===============================================

Re: 我们需要怎样的教育

我的理解是:恐惧不完全是坏事情,恐惧能够提醒我们分辨思考,帮助我们逃避危险。但是当恐惧变成一种巨大的精神负担和无底深渊时,对恐惧的态度是至关重要的:是平和的接受然后思考分析,还是又产生了对当前这种恐惧状态的恐惧,我觉得这是书中探讨的"智慧"- "它是一种无限的包容力,允许你自由地思想;没有恐惧,没有公式, 然后你才能发现什么是真实的、正确的事物。 "如果教育能上升到人性化的教育,现在人们的问题就会少得多了。那教育该由谁来承担呢?我觉得不是一个人、一个家庭、一所学校的责任。我们时时刻刻都在接受教育,也在教育着别人,从自己的生活、工作、自己的家人、朋友、同学、周围所有认识和不认识的,看到的、听到的、想到的、有生命的和没有生命的,每一个都值得我们学习思考。想想那些影响我们生命历程的曾经的陌生人,你就能想象得到我们又是在如何影响别人的生活?过去的都已经过去,不要让过去成为我们成长路上的负担,忘记过去,除了感激什么都不要留下,让我们重新开始吧!

Monday, April 09, 2007

Re: 我们需要怎样的教育

can education should really handle this matter???
i can't but say that the fear is tied up with life beings.
no life being,then no fear.
of course,it perhaps can teach us how to live naturally,hahaha



> 除非教育能帮助你了解广大生命的所有精微面,否则教育是没有什么意义的。
>
> 我们通过一些考试,找到一份工作,结婚,生子,然后就越活越像一部机器。我们依然对生命恐惧、焦虑,因此帮助我们了解人生的整个过程,难道不是教育的目的?还是,教育只为我们谋职或找一份最好的工作而奠基?
>
> 教育的真正意义,难道不是培养你的智慧,借着它找出所有问题的答案? 你知道智慧是什么吗?它是一种无限的包容力,允许你自由地思想;没有恐惧,没有公式,
> 然后你才能发现什么是真实的、正确的事物。
>
> 但是如果你有恐惧,你永远也不可能有智慧。
>
> 如果你的心中有恐惧,你就不能探索、观察、学习,不能深入地察觉。所以,教育的意义很显然就是消除外在的及内在破坏人类思想、关系及爱的那份恐惧。
>
>
> 摘于 《人生中不可不想的事》-----克里希那穆提 著
>
> --
> Happy day, happy life!
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "Not Waste our youth" group.
> To post to this group, send email to not-waste-our-youth@googlegroups.com
> To unsubscribe from this group, send email to not-waste-our-youth-unsubscribe@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/not-waste-our-youth?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>




===============================================
快来和我一起享受TOM免费邮箱吧! 看看除了1.5G,还有什么?

看看女人都在聊什么? 美图尽赏 聊天世界

明星金曲免费送(http://mm.tom.com/ivr/):周杰伦 林俊杰 庞龙 张惠妹

劲爆歌曲尽情点(http://mm.tom.com/ivr/):霍元甲 吉祥三宝 人质 曹操

炫酷彩铃免费送(http://mm.tom.com/cailing/):周杰伦帮你接电话 麻烦女朋友 七里香 小城故事
===============================================

我们需要怎样的教育



除非教育能帮助你了解广大生命的所有精微面,否则教育是没有什么意义的。

我们通过一些考试,找到一份工作,结婚,生子,然后就越活越像一部机器。我们依然对生命恐惧、焦虑,因此帮助我们了解人生的整个过程,难道不是教育的目的?还是,教育只为我们谋职或找一份最好的工作而奠基?

教育的真正意义,难道不是培养你的智慧,借着它找出所有问题的答案? 你知道智慧是什么吗?它是一种无限的包容力,允许你自由地思想;没有恐惧,没有公式, 然后你才能发现什么是真实的、正确的事物。

但是如果你有恐惧,你永远也不可能有智慧。

如果你的心中有恐惧,你就不能探索、观察、学习,不能深入地察觉。所以,教育的意义很显然就是消除外在的及内在破坏人类思想、关系及爱的那份恐惧。


摘于 《人生中不可不想的事》-----克里希那穆提 著

--
Happy day, happy life!

Sunday, April 08, 2007

How to login to our forum Open your heart

1. First, please access http://groups.google.com/group/ShareYourIdea

2.Click “Sign in to Google Groups"

3.If you has a Google account or Gmail account, please input your account name and password to sign in.
Otherwise, Please click “Create an account now” to create a Google account with your email address.

Here are the steps to create a google account with your email address:

1. Click the “Create an account now” at the above screenshot or access the address: “Create an account now”.

2. Input your email address and password that you want to use:

3. Input your nick name, select location, and repeat characters in the picture of the word verification:

4. Please click “I accept Create my account.”


5. You will see the following page. Check email in your email account. Then click “
Click here to continue”. Then you will login to our forum.

Inline Functions In C

REF:http://www.greenend.org.uk/rjk/2003/03/inline.html

Introduction

GNU C (and some other compilers) had inline functions long before standard C introduced them (in the 1999 standard); this page summarizes the rules they use, and makes some suggestions as to how to actually use inline functions.

The point of making a function "inline" is to hint to the compiler that it is worth making some form of extra effort to call the function faster than it would otherwise - generally by substituting the code of the function into its caller. As well as eliminating the need for a call and return sequence, it might allow the compiler to perform certain optimizations between the bodies of both functions.

Sometimes it is necessary for the compiler to emit a stand-alone copy of the object code for a function even though it is an inline function - for instance if it is necessary to take the address of the function, or if it can't be inlined in some particular context, or (perhaps) if optimization has been turned off. (And of course, if you use a compiler that doesn't understand "inline", you'll need a stand-alone copy of the object code so that all the calls actually work at all.)

There are various ways to define inline functions; any given kind of definition might definitely emit stand-alone object code, definitely not stand-alone emit object code, or only emit stand-alone object code if it is known to be needed. Sometimes this can lead to duplication of object code, which is a potential problem for following reasons:

  1. It wastes space.
  2. It can cause pointers to what is apparently the same function to compare not equal to one another.
  3. It might reduce the effectiveness of the instruction cache. (Although inlining might do that in other ways too.)

If any of these are a problem for you then you will want to use a strategy that avoids duplication. These are discussed below.

GNU C inline rules

The GNU C rules are described in the GNU C manual, which is included with the compiler. This is freely available if you follow links from e.g. http://gcc.gnu.org.

  • A function defined with "inline" on its own. Stand-alone object code is always emitted. You can only write one definition like this in your entire program. If you want to use it from other translation units to the one where it is defined, you put a declaration in a header file; but it would not be inlined in those translation units.

    This is of rather limited use: if you only want to use the function from one translation unit then "static inline" below makes more sense, if not the you probably want some form that allows the function to be inlined in more than one translation unit.

    However it does have the advantage that by defining away the "inline" keyword, the program reduces to a portable program with the same meaning (provided no other non-portable constructions are used).

  • A function defined with "extern inline". Stand-alone object code is never emitted. You can have multiple such definitions and your program will still work. However, you should add a non-inline definition somewhere too, in case the function is not inlined everywhere.

    This provides sensible semantics (you can avoid duplicate copies of the functions' object code) but is a bit inconvenient to use.

    One approach to using this would be to put the definitions in a header file, surrounded by a #if that expands to true either when using GNU C, or when the header has been included from the file that is contain the emitted definitions (whether or not using GNU C). In the latter case the "extern" is omitted (for instance writing "EXTERN" and #define-ing that to either "extern" or nothing). The "#else" branch would contain just declarations of the functions, for non-GNU compilers.

  • A function defined with "static inline". Stand-alone object code may be emitted if required. You can have multiple definitions in your program, in different translation units, and it will still work. Just dropping the "inline" reduces the program to a portable one (again, all other things being equal).

    This is probably useful primarily for small functions that you might otherwise use macros for. If the function isn't always inlined then you get duplicate copies of the object code, with the problems described above.

    A sensible approach would be to put the "static inline" functions in either a header file if they are to be widely used or just in the source files that use them if they are only ever used from one file.

C99 inline rules

The specification for "inline" is section 6.7.4 of the C99 standard (ISO/IEC 9899:1999). This isn't freely available, but you can buy a PDF of it from ISO relatively cheaply.

  • A function where all the declarations (including the definition) mention "inline" and never "extern". There must be a definition in the same translation unit. No stand-alone object code is emitted. You can (must?) have a separate (not inline) definition in another translation unit, and the compiler might choose either that or the inline definition.

    Such functions may not contain modifiable static variables, and may not refer to static variables or functions elsewhere in the source file where they are declared.

  • A function where at least one declaration mentions "inline", but where some declaration doesn't mention "inline" or does mention "extern". There must be a definition in the same translation unit. Stand-alone object code is emitted (just like a normal function) and can be called from other translation units in your program.

    The same constraint about statics above applies here, too.

  • A function defined "static inline". A local definition may be emitted if required. You can have multiple definitions in your program, in different translation units, and it will still work. This is the same as the GNU C rules.

main is not allowed to be an inline function.

(If you think I've misinterpreted these rules, please let me know!)

(C++ is stricter: a function which is inline anywhere must be inline everywhere and must be defined identically in all the translation units that use it.)

Recent versions of GNU C have a -std=c99 option, but this doesn't enable C99 inline rules yet. The manual recommends sticking to "static inline", that being the portable subset, and promises C99 semantics in a future release. (But it's been three years since I wrote that, and the situation does not appear to have changed yet.)

Strategies for using inline functions

These rules suggest several possible models for using inline functions in more or less portable ways.

  1. A simple portable model. Use "static inline" (either in a common header file or just in one file). If the compiler needs to emit a definition (e.g. to take its address, or because it doesn't want to inline some call) then you waste a bit of space; if you take the address of the function in two translation units then the result won't compare equal.

    For instance, in a header file:

    static inline int max(int a, int b) {
    return a > b ? a : b;
    }

    You can support legacy compilers (i.e. anything without "inline") via -Dinline="", although this wastes space.

  2. A GNU C model. Use "extern inline" in a common header and provide a definition in a .c file somewhere, perhaps using macros to ensure that the same code is used in each case. For instance, in the header file:

    #ifndef INLINE
    # define INLINE extern inline

Thursday, April 05, 2007

Language C Learning Notes 2

  1. #define
    1. A #define line defines a symbolic name or symbolic constant to be a particular string of characters:
      #define name replacement list
      Thereafter, any occurrence of name (not in quotes and not part of another name) will be replaced by the corresponding replacement text. The name has the same form as a variable name: a sequence of letters and digits that begins with a letter. The replacement text can be any sequence of characters; it is not limited to numbers.
    2. Symbolic constant names are conventionally written in upper case so they can ber readily distinguished from lower case variable names. Notice that there is no semicolon at the end of a #define line.
  2. Macro Substitution
    1. A definition has the form
      #define name replacement text
      It calls for a macro substitution of the simplest kind - subsequent occurrences of the token name will be replaced by the replacement text.
    2. The name in a #define has the same form as a variable name; the replacement text is arbitrary.
    3. Normally the replacement text is the rest of the line, but a long definition may be continued onto several lines by placing a \ at the end of each line to be continued.
    4. The scope of a name defined with #define is from its point of definition to the end of the source file being compiled. A definition may use previous definitions.
    5. Substitutions are made only for tokens, and do not take place within quoted strings.
    6. It is also possible to define macros with arguments, so the replacement text can be different for different calls of the macro.
    7. If you examine the expansion of max, you will notice some pitfalls. The expressions are evaluated twice; this is bad if they involve side effects like increment operators or input and output. For instance
      max(i++, j++) /* WRONG */
      #define max(A, B) ((A) > (B) ? (A) : (B))
      x = max(p+q, r+s);
      will increment the larger twice. Some care also has to be taken with parentheses to make sure the order of evaluation is preserved; consider what happens when the macro
      #define square(x) x * x /* WRONG */
      is invoked as square(z+1).
    8. Names may be undefined with #undef, usually to ensure that a routine is really a function, not a macro:
      #undef getchar
      int getchar(void) { ... }
    9. Formal parameters are not replaced within quoted strings. If, however, a parameter name is preceded by a # in the replacement text, the combination will be expanded into a quoted string with the parameter replaced by the actual argument. This can be combined with string concatenation to make, for example, a debugging print macro:
      #define dprint(expr) printf(#expr " = %g\n", expr)
    10. The preprocessor operator ## provides a way to concatenate actual arguments during macro expansion. If a parameter in the replacement text is adjacent to a ##, the parameter is replaced by the actual argument, the ## and surrounding white space are removed, and the result is re-scanned. For example, the macro paste concatenates its two arguments:
      #define paste(front, back) front ## back
      so paste(name, 1) creates the token name1.
    11. Test Macro usage  

      #include 
      <assert.h>
      #include 
      < setjmp.h>
      #include 
      <stdlib.h >
      #include 
      <stdio.h>
      #include 
      <string.h>
          
      // Test Macro usage    
          
      //
           #undef max
          
      //  Be care to define a macro
          
      // At the end without semicolom, otherwise the semicolom will be at the end of the token
          #define max(A,B)  ((A) > (B) ? (A) : (B))
          
      #define maxName(A,B) ((A) > (B) ? (#A) : (#B))
          
      #undef square
          
      #undef square1
          
      #define square(a) ((a) * (a))
          
      #define  square1(a) (a * a)
          
          
      // #
          #undef dprintf
          
      #define dprintf(expr)  printf(#expr " =%g\n",expr)
          
      //  ##
          #undef paste
          
      #define paste(front,back) front ## back
          
      #undef map
          
      #define map(str) #str
          
      void main()
          {
            
      int a,b,c;
            
      //  Testing max(a,b)  
            printf( "max(a,b):\n");         
            printf(
      "Please input two numbers to compare:\n");
            printf(
      "a=");
            scanf(
      " %i", &a);
            printf(
      "b=");
            scanf(
      " %i",&b);
            printf(
      "Which is bigger, a=%i or b=%i? %s=%i is bigger.\n",a,b, maxName(a,b),max(a,b));    
            
            
      // Testing max(i++,j++)
            printf( "max(i++,j++):\n");
            printf(
      "Please input two numbers to compare:\n");
            printf(
      "a=");
            scanf(
      "%i", & a);
            printf(
      "b=");
            scanf(
      "%i",& b);
            printf(
      "Which is bigger, a=%i or b=%i? %s=%i is bigger.\n ",a,b, maxName(a,b),max(a++,b++ ));            
            printf(
      "Now the a=%i,b=%i.\n" ,a,b);
            
            
            b 
      = 2;
            printf(
      "\nTesting #define square(a) ((a) * (a))\n" );
            printf(
      "Square(%d) = %d\n",b,square(b));
            printf(
      "Square(%d + 1) = %d\n",b,square(b  + 1));
            
            
            printf(
      "\nTesting #define square1(a) (a * a)\n");
            printf(
      "Square1(%d) = %d\n",b,square1(b));
            printf(
      "Square1(%d) = %d\n",b +  1,square1(b +  1));

            
      // Testing  #
            double d =  1.003;
            dprintf(d);
            
      // Testing  ##         
            
      //        char* strd = "Testing";
            
      //        char* str = "Testing";
            double str  = 2.0;
            
      double  strd = 34.0;   
            
      // expected 
            dprintf(str);
            
      //  expected
            dprintf(strd);
            
            printf(
      "%e\n",paste(str,d));
            
            
      // Terminate program
            printf(" Please input any character to end the program:\n");
            
      char* t;
            scanf(
      "%s ",&t); 

          }
  3. Input and Output
    1. The % Format Specifiers:

      The % specifiers that you can use in ANSI C are:

            Usual variable type           Display

      %c        char                     single character
      %d (%i)   int                      signed integer
      %e (%E)   float or double          exponential format
      %f        float or double          signed decimal
      %g (%G)   float or double          use %f or %e as required
      %o        int                      unsigned octal value

      %p        pointer                  address stored in pointer
      %s        array of char            sequence of characters
      %u        int                      unsigned decimal
      %x (%X)   int                      unsigned hex value




s

--
Happy day, happy life!

Wednesday, April 04, 2007

Language C Learning Notes 1

File Inclusion
A control line of the form
# include <filename>
causes the replacement of that line by the entire contents of the file filename. The characters in the name filename must not include > or newline, and the effect is undefined if it contains any of ", ', \, or /*. The named file is searched for in a sequence of implementation-defined places.
Similarly, a control line of the form
# include "filename"
searches first in association with the original source file (a deliberately implementation-dependent phrase), and if that search fails, then as in the first form. The effect of using ', \, or /* in the filename remains undefined, but > is permitted.
Finally, a directive of the form
# include token-sequence
not matching one of the previous forms is interpreted by expanding the token sequence as for normal text; one of the two forms with <...> or "..." must result, and is then treated as previously described.
#include files may be nested.

--
Happy day, happy life!

CuTest Example Compiled with error!

I copy the example from the readme file of CuTest.
However, it compiles with error.

The following the updated version:
DETAILED EXAMPLE

Here is a more detailed example. We will work through a simple
test first exercise. The goal is to create a library of string
utilities. First, lets write a function that converts a
null-terminated string to all upper case.

Ensure that CuTest.c and CuTest.h are accessible from your C
project. Next, create a file called StrUtil.c with these
contents:

#include  <assert.h>
#include 
< setjmp.h>
#include 
<stdlib.h >
#include 
<stdio.h>
#include 
<string.h>
// The origianl version has missed the above includes
#include "CuTest.h"
    
    
char* StrToUpper(char*  str) {
        
return str;
    }
    
    
void  TestStrToUpper(CuTest *tc) {
        
char*  input = strdup(" hello world");
        
char*  actual = StrToUpper(input);
        
char*  expected = " HELLO WORLD";
        CuAssertStrEquals(tc, expected, actual);
    }
   
    CuSuite
* StrUtilGetSuite() {
        CuSuite
* suite =  CuSuiteNew();
        SUITE_ADD_TEST(suite, TestStrToUpper);
        
return suite;
    }

Create another file called AllTests.c with these contents:

    #include  "CuTest.h"
    
    CuSuite
*  StrUtilGetSuite();
    
    
void RunAllTests(void ) {
        CuString 
*output = CuStringNew();
        CuSuite
* suite = CuSuiteNew();
        
        CuSuiteAddSuite(suite, StrUtilGetSuite());
    
        CuSuiteRun(suite);
        CuSuiteSummary(suite, output);
        CuSuiteDetails(suite, output);
        printf(
" %s\n", output->buffer);
    }
    
    
int main(void) {
        RunAllTests();
    }

More detail please see its readme file.
--
Happy day, happy life!

Sunday, April 01, 2007

不管你是狮子还是瞪羚,当太阳升起时,你最好开始奔跑。

在非洲,瞪羚每天早上醒来时,
它知道自己必须跑得比最快的狮子还快,

否则就会被吃掉。

狮子每天早上醒来时,
它知道自己必须超过跑得最慢的瞪羚,

否则就会被饿死。


不管你是狮子还是瞪羚,
当太阳升起时,你最好开始奔跑。

摘于<<The World Is Flat>>

--
Happy day, happy life!