2011-06-26

The Tale of Two pointers in C

by Forrest Sheng Bao http://fsbao.net

The screenplay:

// The Tale of Pointers in C: Demos to refer when using pointers in C
// License: GPL v3.0 
// Author: Forrest Sheng Bao http://fsbao.net Forrest dot His_last_name =aT= gmail.com

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[])
{
        printf("\n\t Every story has a beginning.\n\n");
        int i =10;
        int* a = &i;
        printf("\t We have an integer i=%d\n\n", i);
        printf("\t It is stored in memory address %p.\n\n", a);
        printf("\t To access the integer, we dereference the pointer: %d. \n\n", *a);

        printf("\t For strings, it's a different story \n\n");

        char *sdring;
        if (argc > 1)
        {
                sdring = argv[1];
                printf("\t The first parameter of this shell command is %s\n\n", argv[1]);

                printf("\t The first character is: %c.\n\n", *argv[1]);

                printf("\t The second character is: %c.\n\n", *(sdring+1));

                printf("\t The string from the 2nd character is %s.\n\n", sdring+1);

                *(sdring+10) = "Z";

                printf("\t You won't see a Z: %c.\n\n", *(sdring+10));

/*              printf("\t This will cause a segmentation fault %s", *sdring);*/
        }
}

The final show
$ gcc pointer.c
pointer.c: In function ‘main’:
pointer.c:32: warning: assignment makes integer from pointer without a cast
$ ./a.out abcdef

  Every story has a beginning.

  We have an integer i=10

  It is stored in memory address 0xbfe2646c.

  To access the integer, we can dereference the pointer: 10. 

  For strings, it's a different story 

  The first parameter of this shell command is abcdef

  The first character is: a.

  The second character is: b.

  The string from the 2nd character is bcdef.

  You won't see a Z: U.

2011-06-23

On recognizing human faces is not intelligence

by Forrest Sheng Bao http://fsbao.net

I have worked on two aspects of AI, machine learning (ML) and knowledge representation and reasoning (KRR). I have used machine learning in several biomedical applications and got practical results. But i just do not feel it can be called intelligence. When I recognize a person's face, I do not feel that I am thinking. I wouldn't think a person recognizing other people's faces as intelligent - it's a natural instinct.

Extracting knowledges and reasoning on them to figure out something new (e.g., getting inspired a new idea after reading papers), is what i feel more intelligent. And AI started from it half century ago. But i just do not understand why this field stalled in the past decade (or even longer). This field do not generate new developments as fast as ML nor lead to useful applications as many as ML now. Fewer younger people are joining this field. After the claps of expert system business and research around 1990, this field is not as hot as it used to be. Many AI researchers not working on this field do not know what is happening in this field now. This is really a good field but it might not be on the right track.

I would say that narrow AI way is a reason causing the slow development in KRR. A common way of representing knowledge is to use logic rules. An expert system comprises a knowledge base and an inference engine for it. But the knowledge base is notoriously narrow on specific domains. Obtaining and maintaining massive rules are difficult jobs as well. This approach, which is not general, is very impractical in real applications.

Probably when looking backward to the original goal of AI, can we find a better solution. When i saw ``returning to the original goals of the field'' on AGI 2011 website, i told myself that it was the conference i wanna go, to listen to thoughts on AGI, especially approaches to it. For example, i am interested in why it is so difficult to build a general AI agent and what enables human brain to be more general.

2011-06-21

When a tiger is not longer a tiger

by Forrest Sheng Bao http://fsbao.net

I found out two old pictures today. They were shot in a zoo in China many many years ago.



Tigers in China are mostly in zoos. They are fed like ranch animals everyday. But visitors are unhappy. They want to see real tigers - the big cat that can kill other animals in melee fight, in bloody way.

Therefore, the zoo i went to sent an Asian water buffalo to the cage of a tiger. But it just took forever for the tiger to kill the buffalo. It didn't know the right place to attach a buffalo. It didn't even have the teeth or mouth muscles to bite the buffalo to bleeding. The whole scene was like a game between the tiger and the buffalo.

Then visitors felt bored and all left. And they complained to the zoo that they didn't see a real tiger. 

This is the end of my story.