Gui Guan’s BLOG

There’s more than one way to do it

Cities are an important testing ground for green technologies because urbanization is accelerating rapidly. More than half of the world’s population now lives in cities–and most population growth in coming decades will happen there, mostly in developing countries.

Will cities of the future look like Beijing, pictured here?

read all texts about Cities go green

  • 3 Comments
  • Filed under: Life
  • Finally, I managed to compile a gtk + cairo GUI program by using mingw GNU make and eclipse CDT under Windows XP.

    eclipse CDT + mingw + gtk + cairo

  • 1 Comment
  • Filed under: C
  • internet750.jpg

    read more

  • 1 Comment
  • Filed under: Network
  • Emacs入门指南

    Emacs入门指南(1)

    Emacs入门指南(2)

    Emacs入门指南(3)

  • 0 Comments
  • Filed under: Programming
  • LDBL_MAX -1.#QNAN0e+000 with MinGW?

    I have tried to run this with both eclipse(CDT)+MinGW and Cygwin+GCC

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <float.h>
     
    int main()
      {
        puts("The range of ");
        printf("\tlong double is [%Le, %Le]∪[%Le, %Le]\n", -LDBL_MAX, -LDBL_MIN, LDBL_MIN, LDBL_MAX);
        return EXIT_SUCCESS;
      }

    but got different results:

    • In eclipse(CDT)+MinGW
      The range of
      long double is [-1.#QNAN0e+000, 3.237810e-319]∪[6.953674e-310, 0.000000e+000]
    • In Cygwin+GCC
      The range of
      long double is [-1.189731e+4932, -3.362103e-4932]∪[3.362103e-4932, 1.189731e+4932]

    This is weird, and I googled it, then just found this http://www.thescripts.com/forum/thread498535.html

    The LDBL_MAX of long double is machine-dependent, but why it like this in same machine? I guess it’s the problem with MinGW. Anyone hv any idea?

  • 2 Comments
  • Filed under: C
  • Today, when I was reviewing the session part of PHP, I suddenly came out a question: how to make PHP to append session ID(SID) to your page links automatically when cookies are forbidden in that browser? I managed to do this in JSP, but not sure whether the PHP can also handle this problem.

    I checked the configuration files (php.ini) for my apache server, and there is a session section, under which there is a setting session.use_trans_sid = 0. After I changed this to session.use_trans_sid = 1, and restarted apache, the links of the page which invoked session_start() have now appended the SID. There is also an url_rewriter.tags, with which you can define what elements of a page will be appended.

    Here are some demo codes:

    sessions.php

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    <?php ob_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    	<title>Untitled</title>
    </head>
     
    <body>
    <?php
    	ini_set('session.use_trans_sid','1'); //you can also do this instead of modify php.ini
    	session_start();
    	$_SESSION['test']='right!';
    	//header('Location: sessions2.php'); //SID won't be appended in this situation
    	//exit();
    ?>
    <a href="sessions2.php">click here</a>
    </body>
    </html>
    <?php ob_end_flush(); ?>

    sessions2.php

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    <?php ob_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    	<title>Untitled</title>
    </head>
     
    <body>
    <?php
    	session_start();
    	echo $_SESSION['test'];
    ?>
     
    </body>
    </html>
    <?php ob_end_flush(); ?>
  • 0 Comments
  • Filed under: PHP
  • Make the Most of Taking Lecture Notes

    In many of your classes, your instructor lectures on or makes a presentation about a topic, usually one that’s related to the current subject you’re studying. During a class lecture, your job is to listen actively and to take notes to reinforce what you’ve heard and jog your memory about the key points being presented.

    Instead of writing down every word, listen — really listen — and put the information in perspective. What’s truly important to understand and remember? What’s not? Look for alerts from the lecturer, who may indicate significant information by repeating it, giving multiple examples, writing on the board, gesticulating or speaking forcefully, or giving word clues (”Two important reasons . . .” “Opposing viewpoints from . . .” “The result underscored . . .”). Read the rest of this entry »

  • 1 Comment
  • Filed under: Life
  • Age 1.0beta1

    Here is my first Robocode robot - Age.

    Age_1.0beta1.png

    No need to have an introduction, just have a try if you want. BTW, it uses anti-gravity motion.

  • 3 Comments
  • Filed under: Java
  • Upgraded to Wordpress 2.3

    Finally, I upgraded my Wordpress to 2.3. There is an error with Google XML Sitemaps 3.0b4 or below.

    WordPress database error: [Table 'yourdatabasetable.wp_categories' doesn't exist]
    SELECT cat_id, cat_name FROM wp_categories WHERE link_count >= 1

    For details, see here.

    At this stage, I wish myself upgraded as well. :-D

  • 1 Comment
  • Filed under: Website Log