C Reference Manual Reading Notes: 010 Definition and Replacement

java对csv文件进行读写操作 使用java对csv文件进行读写操作的源代码,包含javacsv.jar 立即下载

1. synopsis

    The #define preprocessor command causes a name (identifier) to become defined as a macro to the preprocessor.  A sequences of tokens, called the body of the macro, is associated with the name. When the name of the macro is recognized in the program source text or in the arguments of certain other preprocessor commands, it is treated as a call to that macro; the name is effectively replaced by a copy of body. If the macro is defined to accept arguments, then the actual arguments following the macro name are substituted for formal parameters in the macro body.

Example:

    If a macro sum with two arguments is defined by

        #define sum(x,y)   ((x)+(y))

    then the preprocessor replaces the source program line

        result = sum(5,a*b)

    with the simple (and perhaps unintended) text substitution

        result = ( (5) + (a*b) );


    Since the preprocessor does not distinguish reserved words from other identifiers, it is possible, in principle, to use a C reserved word as the name of a preprocessor macro, but to do so is usually bad programming practice. Macro names are never recognized within comments, string or character constants, or #include file names.


2. Objectlike Macro Definitions

    The #define command has two forms depending on whether a left parenthesis immediately follows the name to be defined. The simpler, objectlike form has no left parenthesis:

        #define name sequence-of-tokens(optional)

    An objectlike macro takes no arguments. It is invoked merely by mentioning its name. When the name is encountered in the source program text, the name is replaced by the body (the associated sequence-of-tokens, which may be  empty). The syntax of the #define command does not require an equal sign or any other special delimiter token after the name being defined. The body starts right after the name.

    The objectlike macro is particularly useful for introducing named constant into a program, so that a "magic number" such as the length of a table may be written in exactly one place and then refered to elsewhere by name. This makes it easier to change the number later.

    Another important use of objectlike macro is isolate implementation-dependent restrictions on the name of externally defined functions and variables.

Example:

    When a C compiler permits long internal identifiers, but the target computer require short external names, the preprocessor may be used to hide these short names:

        #define error_handler eh73

        extern void error_handler();

    and can be used like as:

        error_handler(...);


    Here are some typical macro definitions:

        #define BLOCK_SIZE    0x100

        #define TRACK_SIZE    (16*BLOCK_SIZE)

    A common programming error is to include an extraneous equal sign:

       #define NUMBER_DRIVERS = 5              /* probably wrong */

    This is a valid definition, but it causes the name NUMBER_DRIVERS to be defined as "=5" rather than "5". If one were then to write the code fragment

        If( count != NUMBER_DRIVERS ) ...

    it would be expanded to

        if ( count != = 5 ) ...

    which is syntactically invalid. For similar resons, also be careful to avoid an extraneous semicolon:

        #define NUMBER_DRIVERS    5;    /* probably wrong */


3. Defining Macros with Parameters

    The more complex, functionlike macro definition declares the names of formal parameters within parentheses separated by commas:

        #define name( identifier-list(optional) ) sequence-of-tokens(optional)

    where identifier-list is a comma-separated list of formal parameter names. In C99, an ellipsis(...; three periods) may also appera after identifier-list to indicate a variable argument list.

    The left parenthesis must immediately follow the name of the macro with no intervening whitespace. If whitespace separates the left parenthesis from the macro name, the definition is considered to define a macro that takes no arguments and has a body beginning with a left parenthesis.

    The names of the formal parameters must be identifiers, no two the same. There is no requirement  that any of the parameter names must be mentioned in the body(although normally they are mentioned). A functionlike macro can have an empty formal parameter list(i.e. zero formal parameters). This kind of macro is useful to simulate a function that takes no arguments.

    A functionlike macro takes as many actual parameters as there are formal parameters. The macro is invoked by writing its name, a left parenthesis, then one actual argument token sequence for each formal parameter, then a right parenthesis. The actual argument token sequences are separated by commas. (When a functonlike macro with no formal parameters is invoked, an empty actual argument list must be provided.) When a macro is invoked, whitespace may appear between the macro name and the left parenthesis or in the actual arguments. (Some older and deficient preprocessor implementations do not permit the actual argument token list to extend across multiple lines unless the lines to be continued end with a /.)

    A acutal argument token sequence may contain parenthesis if they are properly nested and balanced, and it may contain commas if each comma appears within a set of parentheses. (This restriction prevents confusion with the commas that separate the actual arguments.) Braces and subscripting brackets likewise may appear within macro arguments, but they cannot contain commas and do not have to balance. Parentheses and commas appearing with character-constant and string-constant tokens are not counted in the balancing of parentheses and the delimiting of actual arguments.

    In C99, arguments to macro can be empty, that is, consist of no tokens.

Example:

    Here is the definition of a macro that multiplies its two arguments:

        #define product(x,y) ((x)*(y))

    It is invoked twice in the following statement:

        x = product(a+3,b) + product(c,d);

    The arguments to the product macro could be function(or macro) calls. The commas within the function argument list do not affect the parsing of the macro arguments:

        return product( f(g,b), g(a,b) );  /* OK */


    The getchar() macro has an empty parameter list:

        #define getchar()  getc(stdin)

    When it is invoked, an empty argument list is provided:

        while( (c=getchar()) != EOF ) ...

    (Note: getchar(), stdin, and EOF are defined in the standard header stdio.h.)


    We can also define a macro takes as its argument an arbitrary statement:

        #define insert(stmt)    stmt

    The invocation

        insert({a=1; b=1;})

    works properly, but if we change the two assignment statements to a single statement containing two assignment expressions:

        insert({a=1, b=1;})

    then the preprocessor will complain that we have too many macro assignments for insert. To fix the problem, we could have to write:

        insert( {(a=1, b=1);} )


    Definition functionlike macro to be used in statement contexts can be trickly. The following macro swaps the values int its two arguments, x and y, which are assumed to be of a type whose value can be converted to unsigned long and back without change, and to not involve the identifier _temp.

        #define swap(x,y)  {unsigned long _temp = x; x=y; y=_temp;}

    The problem is that it is natural to want to place a semicolon after swap, as you would if swap were really a function:

        if ( x > y ) swap (x, y);    /* whoops*/

        else x = y;

    This will result an error since the expansion includes an extra semicolon. We put the expanded statements on separate lines next to illustrate the problems more clearly:

        if ( x > y ) { unsigned long _temp = x; x = y; y = _temp; }

        ;

        else x = y;

    A clever way to avoid the problem is to define the macro body as a do-while statement, which consumes the semicolon:

        #define swap(x, y )  /

                 do { unsigned long _temp = x; x = y; y = _temp; }while(0)


    When a functionlike macro call is encountered, the entire macro call is replaced, after parameter processing, by  a process copy of the body. Parameter processing preoceeds as follows. Actual argument tokens strings are associated with the corresponding formal parmeter names. A copy of the body is then made in which every occurence of a formal parameter name is replaced by a copy of the actual argument token sequence associated with it. This copy the body then replaces the macro call. The entire process of replacing a macro call with the processed copy of itd body is called macro expansion; the processed copy of the body is called the expansion of the macro call.


Example:

    Consider this macro definition, which provides a convenient way to make a loop that counts from a given value up to(and including) some limit:

        #define incr(v,low,high) /

              for( (v) = (low); (v) <= (high); ++(v) )

    To print a table of the cubes of the integers from 1 to 20, we could write:

        #include <stdio.h>

         int main()

         {

              int j;

              incr(j,1,20)

                   printf("%2d  %6d/n",j, j*j*j);


              return 0;

         }

    The call to the macro incr is expanded to produce this loop:

         for( (j) = (1); (j) <= (20); ++(j) )

    The liberal use of parentheses ensures that complicated acutal arguments are not be misinterpreted by the compiler.


4. Rescanning of Macro Expressions

    Once a macro call has been expanded, the scan for macro calls resumes at the beginning of the expansion so that names of macros may be recognized within the expansion for the purpose of futher macro replacement. Macro replacement is not performed on any part of a #define command, not even the body, at the time the command is processed and the macro name defined. Macro names are recognized within the body only after the body has expanded for some particular macro call.

    Macro replacement is also not performed within the actual argument token string of a functionlike macro call at the time the macro call is being scanned. Macro names are recognized within actual argument token strings only during the rescanning of the expansion, assuming that the corresponding formal parameter in fact occurred one or more times within the body(thereby causing the actual argument token string to appear one or more times in the expansion).


Example:

     Giving the following definitions:

         #define plus(x,y)  add(y,x)

         #define add(x,y)   ((x)+(y))

    The invocation

        plus(plus(a,b),c)

    is expanded as shown next.

                                 Step                           Result

                       1.     original                 plus(plus(a,b),c)

                       2.                                 add(c, plus(a,b))

                       3.                                 ((c)+(plus(a,b)))

                       4.                                 ((c)+(add(b,a)))

                       5.      final                    ((c)+(((b)+(a))))


    Macros appearing in their own expansion--either immediately or through some intermediate sequence of nested macro expansions--are not reexpanded in Standard C. This permits a programmer to redefine a function in terms of its old function. Older C preprocessors traditionally do not detect this recursion, and will attempt to continue the expansion until they are stopped by some system error.


Example:

    The following macro changes the definition of the square root function to handle negative arguments in  a different fashion than is normal:

        #define sqrt(x)    ( (x) < 0 ? sqrt(-x) : sqrt(x) )

    Except that it evaluates its argument more than once, this macro work as intended in Standard C, but might cause an error in older compilers. Similarly:

        #define char unsigned char


5. Predefined Macros

    Preprocessors for Standard C are required to define certain objectlike macros. The name of each begins and ends with two underscore characters. None of these predefined may be undefined (#undef) or redefined by the programmer.

    The __LINE__ and __FILE__ macros are useful when printing certain kinds of error messages. The __DATE__ and __TIME__ macros can be used to record when a compilation occured. The values of __TIME__ and __DATE__ remain constant throughout the compilation. The values of __FILE__ and __LINE__ macros are established by implementation, but are subject to alteration by the #line directive(like as #line 300 or #line 500 "cppgp.c"). The C99 predefined identifier __func__ is similar in purpose to __LINE__, but is actually a block-scope variable, not a macro. It supplies the name of the enclosing function.

    The __STDC__ and __STDC_VERSION__ macros are useful for writing code compatible with Standard and non-Standard C implementations. The __STDC_HOSTED__ macro was introduced in C99 to distinguish hosted from freestanding implementations. The remaining C99 macros indicate whether the implementation's floating-point and wide character facilities adhere to other relevant international standards(Adherence is recommended, but not required)

    Implementation routinely define additional macros to communicate information about the enviroment, such as the type of computer for which the program is being compiled. Exactly which macros are defined is implementation-dependent, although UNIX implementations customarily predefine unix. Unlike the built-in macros, these macros may be undefined. Standard C requires implementation-specific macro names to begin with a leading underscore followed by either an uppercase letter or another underscore.(The macro unix does not meet that criterion.)

    And the example about the predefined macros will be appended the next subject.


6. Undefining and Redefining Macros

    The #undef command can be used to make a name be no longer defined:

        #undef name

    This command causes the preprocessor to forget any macro definition of name. It is not an error to undefine a name currently not defined. Once a name has been undefined, it may then be given a completely new definition(using #define) without error. Macro replacement is not performed within #undef commands.

    The benign redefinition of macros is allowed in Standard C and many other implementations. That is, a macro may be redefined if the new definition is the same, token for token, as the existing definition. The redefinition must include whitespace in the same locations as in the original definition, although the particular whitespace characters can be different. We think programmers should avoid depending on benign redefinitions.  It is generally better style to have a single point of definition for all program entities, including macros. (Some older implementations of C may not allow any kind of redefinition.)

Example:

    In the following definitions, the redefinition of NULL is allowed, but neither redefinition of FUNC is valid. (The first includes whitespace not in the original definition, and the second changes two tokens.)

        #define NULL 0

        #define FUNC(x)    x+4

        #define NULL    /* null pointer */ 0

        #define FUNC(x)    x + 4

        #define FUNC(y)    y+4

    (But I make a test on fedora10 platform with gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC), Both the FUNC redefinition is valid too. why ?)


    When the programmer legitimate reasons cannot tell if a previous definition exists, the #ifndef can be used to test for an existing definition so that a redefinition can be avoided.:

        #ifndef MAX_TABLE_SIZE

        #define MAX_TABLE_SIZE 1000

        #endif

    Thisidiom is particularly useful with implementations that allow macro definitions in the command that invokes the C compiler. For example, the following UNIX invocation of C provides an initial definition of the macro MAX_TABLE_SIZE as 5000. The C programmer would then check for the definition as shown before:

        cc -c -DMAX_TABLE_SIZE=5000 prog.c


    Although disallowed in Standard C, a few older preprocessor implementations handle #define and #undef so as to maintain a stack of definitions. When a name is redefined with a #define, its old definition is pushed onto a stack and then the new definition replaces the old one. When a name is undefined with #undef, the current definition is discarded and the most recent previous definition (if any) restored.


7. Precedence Errors In Macro Expansions

    Macros operate purely by textual substitution of tokens. Parsing of the body into declarations, expressions, or statements occurs only after the macro expansion process. This can lead to surprising results if care is not taken. As a rule, it is safest to always parenthesize each parameter appearing in the macro body. The entire body, if it is syntactically an expression, should also be parenthesized.


Example:

    Consider this macro definition:

        #define  SQUARE(x)    x*x

    The idea is that SQUARE takes an argument expression and produces a new expression to comput the square of that argument. For example, SQUARE(5) expands to %*5. However, the expression SQUARE(z+1) expands to z+1*z+1, which is parsed as z+(1*z)+1 rather than expected (z+1)*(z+1). A definition of SQUARE that avoids this problem is:

        #define SQUARE(x)    ((x)*(x))

    The out parentheses are needed to prevent misinterpretation of an expression such as (short)SQUARE(z+1).


8. Side Effects In Macro Arguments

    Macros can also produce problems dut to side effects. Because the macro's actual arguments may be textually replicated, they may be executed more than once, and side effects in the actual arguments may occur more than once. In contrast, a true function call--which the macro invocation resembles--evaluates argument expressions exactly once, so any side effects of the expression occur exactly once. Macros must be used with care to avoid such problems.


Example:

    Consider the macro SQUARE from the prior example and also a function square that does (almost) the same thing:

        int square(int x) { return x*x; }

    The macro can square integers or floating-point numbers; the function can square only integers. Also, calling the function is likely to be somewhat slower at run time than using the macro. But these differences are less important than the problem of side effects. In the program fragment

        a = 3;

        b = square(a++);

    the variable b gets the value 9 and the variable a ends up with the value 4. Howerver, in the superficially similar program fragment

        a = 3;

        b = SQUARE(a++);

    the variable b may get the value 12 and the variable a may end up with the value 5 because the expansion of the last fragment is

        a = 3;

        b = ((a++)*(a++));

    (Say that 12 and 15 may be the resulting values of b  and a because Standard C implementations may evaluate the expression ((a++)*(a++)) in different ways.)


9. Converting Tokens to Strings

    There is a mechanism in Standard C to convert macro parameters (after expansion) to string constants. Before this, programmers had to depend on a loophole in many C preprocessors that achieved the same result in a different way.

    In Standard C, the # token appearing within a macro definition is recognized as a unary "stringization" operator that must be followed by the name of a macro formal parameters. During macro expansion, the # and the formal parameter name are replaced by the corresponding actual argument enclosed in string quotes. When creating the string, each sequence of whitespace in the argument's token list is replaced by a single space character, and any embedded quotation or backslash character characters are preceded by a backslash character to preserve their meaning in the string. Whitespace at the beginning and end of the argument is ignored, so an empty argument (even with whitespace between the commas) expands to the empty string "".


Example:

    Consider the Standard C definition of macro TEST:

        #define TEST(a, b )    printf( #a " < " #b " = %d/n", (a)<(b) )

    The statement TEST(0, 0XFFFF);  TEST('/n', 10); would expand into

        printf("0" "<" "0xFFFF" " = %d/n", (0)<(0XFFFF));

        printf(" '//n' " "<" "10" " = %d/n", ('/n') <(10) );

    After concatenation of ajacent strings, these become:

        printf("0 < 0xFFFF = %d/n", (0) < (0XFFFF) );

        printf(" '//n' < 10 = %d/n", ('/n') <(10) );


    A number of non-standard C compilers will substitute for macro formal parameters inside string and character constants. Standard C prohibits this.

    The handling if whitespace in non-ISO implementations is likely to vary from compiler to compiler--another reason to avoid depending on this feature except in Standard C implementations.


10. Token Merging In Macro Expansions

    Merging of tokens to form new tokens in Standard C is controlled by the presence of a merging operator, ##, in macro definitions. In a macro replacement list--before rescanning for more macros--the two tokens surrounding any ## operator are combined into a single token. There must be suck tokens: ## must not appear at the begnning or end of a replacement list. If the combination does not form a valid token, the result is undefined.

        #define TEMP(i)   temp ## i

        Temp(1) = TEMP(2+k) + x;

    After preprocessing, this becomes

        temp1 = temp2 + k + x;

 

    In the previous example, a curious situation can arise whe expanding TEMP() + x. The macro definition is valid, but ## is left with no right-hand token token to combine (unless it grabs +, which we do not want). This problem is resolved by treating the formal parameter i as if it expanded to a special "empty" token just for the benefit of ##. Thus, the expansion of TEMP() + x would be temp + x as expected.

 

    Token concatenation must not be used to produce a unversal character name.

 

    As with the conversion of macro arguments to strings, programmers can obtain something like this merging capability through a loophole in many non-Standard C implementations. Although the original definition of C explicitly described macro bodies as being  sequences of tokens, not sequences of characters, nevertheless many C compilers expand and rescan macro bodies as if they were character sequences. This becomes apparent primarily in the case where the compiler also handles comments by eliminating them entirely (rather than replacing them with a space)--a situation exploited by some cleverly written programs.

 

Example:

    Consider the following example:

        #defi n e INC    ++

        #define TAB    internal_table

        #define INCTAB table_of_increments

        #define CONC(x,y) x/**/y

        CONC(INC,TAB)

    Standard C interprets the body of CONC as two tokens, x and y, separated by a space.(Comments are converted to a space.) The call CONC(INC,TAB) expands to the two tokens INC TAB. Howerver, some non-Standard implementations simply eliminate comments and rescan macro bodies for tokens; the expand CONC(INC,TAB) to the single token INCTAB.

 

    Step              1                2             3          4

    Standard          CONC(INC,TAB)    INC/**/TAB    INC TAB    ++ internal_table

    non-Standard      CONC(INC,TAB)    INC/**/TAB    INCTAB     table_of_increments

 

11. Variable Argument Lists In Macro

    In C99, a functionlike macro can have as its last or only formal parameter an ellipsis, signifying that the macro may accept a variable number of arguments:

        #define name( identifier-list, ... ) sequence-of-tokens(optional)

        #define name( ... ) sequence-of-tokens(optional)

    When such a macro is invoked, there must be at least as many actual arguments as there are identifiers in identifier-list. The trailing argument ( s), including any separating commas, are merged into a single sequence of preprocessing tokens called the variable arguments. The identifier __VA_ARGS__ appearing in the replacement list of the macro definiton as treated as if it had been a macro parameter whose argument was the merged variable arguments. That is, __VA_ARGS__ is replaced by the list of extra arguments, including their comma separators. __VA_ARGS__can only appear in a macro definition that includes ... in its parameter list.

    Macro with a variable number of arguments are often used to interface to functions that takes a variable number of arguments, such as printf. By using # stringization operator, they can also be used to convert a list of arguments to a single string without having to enclosing the arguments in parentheses.

 

Example:

    These directives create a macro my_printf that can write its arguments either to the error or standard output.

        #ifdef DEBUG

        #define my_printf( ... ) fprintf(stderr, __VA_ARGS__)

        #else

        #define my_printf( ... ) fprintf(stdout, __VA_ARGS__)

        #endif

 

    Given the definition

        #define make_em_a_string( ... ) #__VA_ARGS__

    the invocation

        make_em_a_string(a, b, c, d)

    expands to the string

        "a, b, c, d"

 

12. Other Problems

    Some non-Standard implementations do not perform stringent error checking on macro definitions and calls, including permitting an incomplete token in the macro body to be completed by text appearing after the macro call. The lack of error checking by certain implementations does not make clever exploitation of that lack legitimate. Standard C reaffirms that macro bodies must be sequences of well-formed tokens.

 

Example:

    For example, the folloing fragment in one of these non-ISO implementations:

        #define STRING_START_PART   "This is a split"

        ...

        printf(STRING_START_PART string."); /* !!!! Yuk */

    will, after preprocessing, result in the source text

        printf("This is a split string.");

西周BC996年世界历史地图矢量文件SHP格式.zip 本资源为《西周BC996年世界历史地图矢量文件SHP格式》压缩包,文件大小约 28.70 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。 立即下载

相关推荐

西周BC974年世界历史地图矢量文件SHP格式.zip

本资源为《西周BC974年世界历史地图矢量文件SHP格式》压缩包,文件大小约 28.64 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

记录一次Apache Commons CSV库中封装的令牌和定界符之间的字符无效

使用Apache Commons CSV库解析CSV文件时出现以下错误。 java.lang.IllegalStateException: IOException reading next record: java.io.IOException: (line 1) invalid char between encapsulated token and delimiter at org.apache.commons.csv.Lexer.parseEncapsulatedToken(Le...

Dengrz的Blog 5044

西周BC904年世界历史地图矢量文件SHP格式.zip

本资源为《西周BC904年世界历史地图矢量文件SHP格式》压缩包,文件大小约 28.59 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

解决EasyExcel写入数据时的Invalid char错误

在项目中使用EasyExcel写入Excel数据时,遇到了Invalid char错误。该错误通常由于Excel表格命名规范不符合要求导致。Excel对工作表名有一些基本的规定,如不能超过31个字符、不能以空格开头或结尾、不能包含特殊字符(如:、/、\、?、*、[、]、、:)。为解决此问题,我们编写了一个修复方法,将不符合规范的字符替换为下划线、去除首尾空格、限制长度,并在数据写入前调用该方法。这样可确保工作表名符合Excel命名规范,解决了Invalid char错误。

君若雅的博客 2086

11264 近等温强力旋压成形技术文章.docx

技术分享、工艺技术

112703 汽车离合器毂形态与加工工艺选择及参数化边界.docx

技术分享、工艺技术

EasyExcel导入实战问题汇总

之前在文章中简单的介绍过EasyExcel的导出与导入方法,导出一般比较容易理解,导入的方法对于新手来说就有一些困难,接下来我介绍一下easyExcel的导入难点,展示一下工作中如何使用。 如果还不了解导入的内容,请看这篇文章 EasyExcel的导出与导入 难点一 导入的Excel有备注内容,需要忽略 解决方法:在Excel的实体映射类中,使用下面的注解,会只取表头为此值的列,其他列自动忽略。 @ExcelProperty(value = "表头1") 难点二 如何获得导入的对象列表或想要的信息 @

虚心学习,和气编码 2420

算力算法数据一体化供给的城市级AI大模型算力池建设方案.docx

算力算法数据一体化供给的城市级AI大模型算力池建设方案.docx

EasyExcel实现execl导入导出

在实际开发中,处理 Excel 文件是一个常见的需求。EasyExcel 是一个基于 Java 的开源库,提供了简单易用的 API,可以方便地读取和写入 Excel 文件。本文将介绍如何使用 EasyExcel 实现 Excel 导入功能,以及一些相关的技巧和注意事项。

阿水的博客 1万+

顶刊复现改进优化反演控制的水面舰艇自适应跟踪控制程序

内容概要:本文系统整理了一套面向科研领域的MATLAB/Simulink仿真资源合集,聚焦于水面舰艇、水下机器人(AUV/UUV)、多智能体系统及复杂工业系统的先进控制与路径规划技术。资源涵盖改进优化反演控制、事件触发通信机制、模糊PID与传统PID对比分析、全局积分滑模控制(GISMC)、基于李雅普诺夫的模型预测控制(MPC)、LOS+反步法三维路径跟踪、改进人工势场法(APF)路径规划、RRT与贪心平滑结合的机械臂避障等多项前沿算法的完整仿真实现。所有资源均强调“顶刊复现”,配备详细的说明文档、可运行代码与Simulink模型,旨在还原高水平学术研究成果的核心技术路径。; 适合人群:适用于自动化、控制工程、海洋工程、机器人、电力系统及智能制造等相关领域的研究生、博士生与科研人员,要求具备良好的MATLAB编程能力及控制理论基础;; 使用场景及目标:①高效复现顶级期刊论文中的先进控制算法,加速科研进程;②开展多智能体协同控制、无人船/水下航行器自主导航、复杂系统优化调度等方向的仿真验证;③支持高水平论文撰写、课题申报与技术创新;④构建可扩展的科研验证平台,实现算法对比与性能优化;; 阅读建议:建议按照提供的资源目录循序渐进地学习,结合百度网盘中的代码与模型动手实践,重点关注算法设计原理、参数整定方法与仿真调试过程,同时关注公众号“荔枝科研社”获取持续更新的技术支持与最新资源。

钉钉视频下载工程纯gui视图vb6

钉钉视频下载工程纯gui视图vb6

EasyExcel实现导入功能

1.导入依赖 <!-- xls格式excel依赖包 --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.17</version> </dependency> <!--xlsx格式excel依赖包--> <dependency>

Clsrm的博客 5267

UninstallTool-3.8.2 绿色补丁

开箱即用 只有补丁 没有本体。

IllegalArgumentException: Invalid token character ',' in token "json, text/javascript, */*; q=0.01"

兴酣落笔摇五岳,诗成笑傲凌沧洲 昨天,在项目中加了Xss攻击过滤之后,,发现原来写的代码好多地方都报错了,错误截图如下: 最后检查发现,这些报错的地方有一个共同点,那就是都加了下面这个: @RequestMapping(value = &quot;/xxx.json&quot;, produces = &quot;application/json; charset=utf-8&quot;) @ResponseBod...

A_Runner的博客 5017

第三节: 串口通信(用CubeMX学习STM32)

用CubeMX学习STM32, 串口通信学习, 通过轮询方式和中断方式两种方式进行通信演示。 STM32F407zgt6

Kevin_8_Lee的博客 8909

避开生产计划大坑:不懂MPS和MRP的区别,你的SAP PP模块白学了

本文深入解析SAP PP模块中MPS(主生产计划)与MRP(物料需求计划)的核心区别,揭示如何通过正确配置避免生产计划中的常见陷阱。文章详细探讨了MPS的三大缓冲特性和动态平衡算法,帮助企业提升生产计划稳定性,优化资源配置,避免生产线波动。

weixin_29268267的博客 414

[pytorch修改]npyio.py 实现在标签中使用两种delimiter分割文件的行

from __future__ import division, absolute_import, print_function import io import sys import os import re import itertools import warnings import weakref from operator import itemgetter, i...

weixin_30649641的博客 2078

Ubuntu 22.04 安装 PostgreSQL + AGE + pgvector 完全指南

本教程详细介绍了在Ubuntu 22.04服务器上安装PostgreSQL数据库,并为其添加AGE图数据库扩展和pgvector向量搜索扩展的步骤。首先,更新系统并安装PostgreSQL,然后通过源码构建并安装AGE和pgvector扩展。接着,配置PostgreSQL以使用这些扩展,并可选地允许远程连接。教程还包括创建用户、设置密码、验证安装以及安装后的优化建议。最后,提供了常见问题的解决方法。通过本教程,用户可以在同一数据库中处理关系型数据、图数据和向量数据,为现代应用程序提供强大的数据支持。

这个是个人博客,记录生活中的一些日常。 1746

Python之requests错误Expecting value: line 1 column 1 (char 0)

参考文章:https://www.cnblogs.com/loveprogramme/p/9379532.html因为介绍到json模块,所以我就记录下来 0、昨天使用requests发出post请求,报了一个 Expecting value: line 1 column 1 (char 0) 1、开始想办法解决,后面打开charles,发现本来应该是放在body中的参数,全部放到url中 ...

王员外的博客 5万+

华为OD机试真题 新系统 11.22【智能文本压缩解码】

华为OD机试真题 新系统【智能文本压缩解码】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题 【智能文本压缩解码】多语言题解。

qq_45776114的博客 385

【Docker安装】Ubuntu 24.04.2 LTS系统下安装Docker环境——指定APT源安装方式

【Docker安装】Ubuntu 24.04.2 LTS系统下安装Docker环境——指定APT源安装方式

jks212454的博客 630
上一篇: C Reference Manual Reading Notes: 009 Preprocessor Lexical Conventions
下一篇: Linux总线驱动-01: 一个简单的示例
cppgp
博客等级 码龄20年 47粉丝 46原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址