网络资源的拷贝粘贴 备份参考之用


29 July 2008

Christian the Lion

John Rendall and Ace Berg found a cub for sale at Harrod's in a cramped space. They bought the cub and named him Christian. They played with Christian on the grounds of a church until he became to big to keep at home. The introduced him back into the wild of Africa.
One year later they went to see Christian in the wild. They were told that the lion was wild now, the head of his own pride and would not remember them. Here is their
courageous story.

Christian, the lion who lived in my London living room

By VICTORIA MOORE
Last updated at 23:24 04 May 2007
 
He travelled by Bentley, ate in fine London restaurants and spent his days lounging in a furniture shop. The story of Christian the pet lion - and his eventual release into the wild - is as moving as it is incredible.

The furniture shop was on the King's Road in London. It sold tables, wardrobes, chairs and desks - but anybody peering through its plate-glass window on a Sunday might have noticed something rather more unusual.

Amid all the pine and oak, stretched out languidly on a bench, there was a lion. And it wasn't stuffed.

Scroll down for more...

Tiger feet: Christian enjoyed living in swinging London

Tiger feet: Christian enjoyed living in swinging London

"Christian used to lie beside me while I did the accounts at weekends," remembers Jennifer Mary Taylor, who worked there.

"And every so often, if I'd ignored him for too long, he'd sock me across the head with one of his great big paws.

"He was very loving and affectionate - he liked to stand and put his paws on your shoulders. But he was...", she pauses. "I mean, he was a lion. Does that sound silly?"

Christian the lion (named by someone with a Biblical sense of humour) arrived in

Chelsea at a time when the King's Road - home to Mick Jagger - was the very heart of the Swinging Sixties.

For a year, the Big Cat was part of it all, cruising the streets in the back of a Bentley, popping in for lunch at Casserole, a local restaurant, even posing for a Biba fashion advert.

He eventually grew too big to be kept as a pet and was taken to Kenya, where he was rehabilitated into the wild by the 'Lion Man', George Adamson.

Now, his story is to be told in a new book, written by the Australian John Rendall who, along with his friend Ace Berg, bought Christian from Harrods in 1969.

John Rendall's Chelsea flat

London pride: At home in John Rendall's Chelsea flat

So what possessed them to buy a lion cub in the first place?

"A friend had been to the 'exotic animals' department at Harrods and announced, rather grandly, that she wanted a camel," says Rendall.

"To which the manager very coolly replied: 'One hump or two, madam?'

"Ace and I thought this was the most sophisticated repartee we'd ever heard, so we went along to check it out - and there, in a small cage, was a gorgeous little lion cub. We were shocked. We looked at each other and said something's got to be done about that."

Harrods, it turned out, was also quite keen to be rid of Christian, who had escaped one night, sneaked into the neighbouring carpet department - then in the throes of a sale of goatskin rugs - and wreaked havoc.

The store, which had acquired the cub from Ilfracombe zoo, happily agreed to part with him for 250 guineas. So began Christian's year as an urban lion.

Today, it would be unthinkable for a shop to take such a cavalier attitude towards selling exotic animals (though Harrods did, at least, provide Ace and Rendall with diet sheets).

And it is hard to imagine either the animal rights lobby or any local council condoning a shop as a suitable habitat for a lion. But, back then, no one minded at all.

Christian was given his own living quarters (and a very large kitty-litter tray, which he used unfailingly) in the basement of the appropriately named Sophistocat furniture shop.

"He had a beautiful musky smell that was very distinct," says Rendall. "But he was clean."

The vicar of the Moravian Chapel nearby was approached to allow Christian the run of the graveyard, and every day he was taken there to roar around and play football.

Once, when he was brought along to a seaside picnic, he dipped his toes reluctantly in the water and intimated with a shudder that it was disagreeably cold. But he was eventually persuaded to swim in the English Channel.

"He was a lot of work," says Rendall. "It took all four of us - me, my then girlfriend Jennifer Mary, Ace Berg and an actress called Unity Jones - to look after him.

Cat's pyjamas: Christian, rummaging through the drawers

Cat's pyjamas: Christian, rummaging through the drawers

"He also ate a lot, four meals (two liquid, two solid) plus supplements every day, which cost about £30 a week - a lot of money back then."

He pauses, then adds, "And he had a very good sense of humour."

Really?

"Oh yes. Sometimes, he'd see people staring at him through the back window of the car, keep very still on purpose - and then, just when they were convinced he was a stuffed toy, he would very slowly turn his head and freak them out."

Everyone loved Christian and he became a popular local figure. In 1970, when Chelsea beat Leeds in the FA Cup Final, Sophistocat received a call from a policeman, 'The football fans are going to be boisterous, so you'd better get your bloody lion out of the window or they'll smash it in,' he warned.

Christian himself was beautifully behaved, and though he never hurt anyone, you underestimated his strength at your peril.

Jennifer Mary remembers taking a friend to see him, "after I'd had one or two glasses of wine -and when he put his paws on my shoulders, one of them slipped, his claw caught my dress and he pulled the whole front of it off."

He grew and grew - from 35lb when he first arrived to a rather more serious and imposing 185lb a year later - and he was beginning to acquire a mane that made him look more fearsome.

He clearly could not stay with his two young owners for ever.

His future was decided by a chance encounter - when the actors Bill Travers and Virginia McKenna walked into the shop to buy a pine desk.

They had recently starred in the film Born Free, which tells the true story of the wildlife conservationist George Adamson and his wife Joy, who raised a lion cub called Elsa in Kenya then rehabilitated it into the wild.

And they immediately suggested that Adamson might be able to help.

Certainly, the conservationist was intrigued by the challenge of introducing a King's Road lion to the wilds of Africa.

"But," he warned, '"ou must be prepared for this not to work. Elsa was born in Africa and she knew its smells. Taking a British-born lion, whose parents were also raised in captivity, is going to be a very different thing."

Christian was flown to Kenya in a specially-made crate emblazoned with the words, 'East African Airways. London-Nairobi. Christian - male lion, 12 months'. John and Ace went with him.

"I think George Adamson got quite a shock when he met us," says Rendall. "Straight from the King's Road, in all our gear - flares from Granny Takes A Trip, and with hair everywhere.

"We looked rather different from everyone else in Nairobi. But then so did Christian. He'd come from winter in England, so had a very thick coat - he was almost as hairy as we were."

Adamson wanted to drive straight to the Kora Reserve, close to the Tana river, where there was no human habitation. This, he felt, would be the ideal spot to build a camp.

Because lions live and hunt in prides, and it is hard to impose a new male on an existing one, the plan was to introduce Christian into the wild in tandem with Boy, one of the tame beasts who had starred in Born Free.

Together, they would form the nucleus of a new pride - and the whole project would be funded by a TV programme.

Christian was marshalled into the back of a Land Rover, with straw on the floor and chicken-wire separating him from his friends on the front seat. It was all rather confusing for a lion accustomed to the butter-soft leather of a Bentley. And he was hot. And dusty. And confused.

Not long into the journey, Rendall ventured, "Mr Adamson, he needs to go to the loo."

Adamson was impatient.

"We're miles from anywhere. If we stop here and he runs away, we will never, ever catch him."

"Mr Adamson," promised Rendall, "that is not going to happen."

The great Lion Man turned his head, sucked on his pipe and pulled over on the dirt road.

Rendall opened the back of the car, and Christian jumped out to take his first real steps on African soil.

To his evident disgust, it was prickly and hot. He clearly didn't like it one bit.

Rendall picks up the story, "So he went tip-toeing along and went to the loo.

Considerably. Then he looked around and I said, 'OK, come on, back in,' pointed back at the car - and in he jumped.

"I got back in the car, too, shut the door and George Adamson turned round and said to me, 'That is quite remarkable. You may call me George.'"

Kora, an area that now has National Park status, lies about 220 miles to the north-east of Nairobi. The scenery is rugged - densely packed with knotty thorn bushes, with just a narrow corridor of greenery that follows the course of the Tana river.

And so Christian arrived at the camp, which Adamson's brother had built from macuti - palm fronds - chicken-wire and mud.

The conservationist went off again and returned a couple of days later with Boy, the lion from Born Free.

At that time, Boy was very fragile, as his shoulder had been shattered in a nasty encounter with a buffalo. But he was the first fully-grown lion that Christian had seen since leaving Ilfracombe zoo as a cub.

The first meeting was explosive. Normal lion protocol dictates that the younger male should be subservient to the dominant male.

But Christian, more schooled in Sloane than feline etiquette, sashayed fearlessly towards Boy.

Fortunately, Christian and Boy, though in adjacent compounds, were separated by a wire fence. In fury at the perceived slight, Boy flung himself against it - until Christian, suddenly realising his faux pas, slunk away with his belly close to the ground.

This process was repeated over and over again until Adamson felt confident enough to allow the pair to meet without the safety barrier of the fence.

"First, Boy left his compound," recalls Rendall. "Then Christian went out to meet him.

"Boy took one look - and he clobbered him. Christian didn't fight back. He rolled over on his back. That went on for day after day, until Boy was obviously satisfied that Christian knew who was boss - and they became totally inseparable."

Adamson had also acquired a female lion cub, Katania, to add to the pride, and she seemed to act as an intermediary between the two males.

Each day, the three lions would go out for a walk in the bush, Boy first, Katania in the middle, then Christian - with Adamson, carrying a rifle in case he needed to scare anything off, at the rear.

For Christian, there were some tricky moments, such as the time he spied a rhino and tried to stalk it, only for the beast to hurl him through the air in a cloud of dust.

"I saw Boy turn and look at Christian," says Rendall. "There was a look on his face, as if to say: 'You absolute fool. What a howler of a blunder.'"

Slowly, progress was made. The biggest threat to Christian and Boy were the wild lions that stalked the reserve, which Boy was fighting to establish as his territory.

Then, one day, there was a tragedy that caused the whole project to be called into question. A chef called Stanley had left the safety of the compound to look for wild honey. He hadn't realised Boy was nearby, and when he saw him, he tried to flee.

Running away was the worst action he could have taken. Adamson, hearing Stanley's screams, came running and shot Boy through the heart - but it was too late. Stanley had been bitten through the jugular and died an hour later.

The outcry that followed almost brought the lion project to a halt, but Adamson found some support for his work among other conservationists, dug in his heels and carried on.

John Rendall and Ace Berg continued to make sporadic visits to Kenya, but mostly they followed Christian's adventures from afar.

Finally, in 1974, George Adamson wrote to say that the pride was self-sufficient. Christian was defending it. There was a litter of cubs. They were feeding themselves and rarely returned to camp.

The King's Road lion had finally adapted to the wild.

This was a bittersweet moment for all concerned. Rendall and Ace decided to travel to Kora one last time, in the hope of being able to say goodbye, though Adamson warned them that it would almost certainly be a wasted mission.

"Christian hasn't been here for nine months. We have no reason to think he's dead - there have been no reports of lions poached or killed. But he may never come back," he said.

Rendall recalls, "We said: 'OK. We appreciate that, but we'll come anyway and see you.'"

They flew to Nairobi then took a small plane to the camp in Kora, where Adamson came out to meet them.

"Christian arrived last night, " he said simply. "He's here with his lionesses and his cubs. He's outside the camp on his favourite rock. He's waiting for you."

Adamson and his wife Joy often talked about the mysterious, apparently telepathic communication skills of lions - particularly between lions and men.

Both believed that lions were possessed of a sixth sense and George was convinced that a scientific explanation would one day be found.

And here, it seemed, was the proof.

"Christian stared at us in a very intense way," says Rendall. "I knew his expressions and I could see he was interested. We called him and he stood up and started to walk towards us very slowly.

"Then, as if he had become convinced it was us, he ran towards us, threw himself on to us, knocked us over, knocked George over and hugged us, like he used to, with his paws on our shoulders.

"Everyone was crying. We were crying, George was crying, even the lion was nearly crying."

"The lionesses were far from pleased. There was a lot of growling and spitting," continues Rendall.

"'George said: 'This isn't safe - we'd better go.' So we each put a hand on Christian's back and he walked with us back to camp."

The reunion party went on all night and into the morning. Leaving his exhausted companions to go to their beds, Christian returned to his pride.

"We watched him go back to the two lionesses, who were not at all happy with this man, smelling of nicotine, whisky and humans," says Rendall.

"He just walloped the two of them with his paw, then collapsed."

And that was the last anyone ever saw of him.

For the next 14 years, George Adamson remained at Kora, rehabilitating several other lions and ignoring warnings from the authorities, who did not consider it safe for him to stay.

Then, in 1989, he was ambushed and murdered by bandits.

He died with a gun in his hand and, in accordance with his wishes, was buried at Kora.

Following his death, his supporters formed the George Adamson Wildlife Preservation Trust, which now does work in Kora as well as in Tanzania, where it is reintroducing the endangered black rhino and hunting dog.

The trust's chief aim is keep alive Adamson's dream of a place where animals can roam free - a fitting epitaph not just for the great conservationist but also for the lion who once lived in Chelsea.
 
 
 

24 July 2008

什么是回调函数 (Call Back)

 1)
最简单的说就是由你编写,但由Windows调用的函数
其实跟一般的函数没有什么特别区别,只是回调函数的形式是规定好的(就是返回值,形参数等等),你可以改变的值就是函数的名称:)
回调函数不用你去直接调用,而是由调用这个回调函数的函数来调用
2)
回调函数的形式是规定好的(就是返回值,形参数等等),实质是函数指针,传给调用函数的参数是函数指针
3)
回调函数简单的说就是在每个时间要用的函数,但是当时没有函数体,
相当于纯虚函数!
 
4)
个人观点:
回调函数,用户写系统调用的函数。
系统:广义,可能是函数、程序、操作系统,不局限于windows
用户:广义,与系统对应
 
5)
回调函数其实跟普通函数是一样的,只不过调用者不是你,而是系统,系统会根据你设计的回调的函数完成相关的工作。比如,你创建一个窗口时,你要设计一个回调函数,告诉它窗口的消息如何映射;再如创建一个定时(NUL器时,用SetTimer(L,1000,TimerProc);这个TimerProc就是一个回调函数,你可以这个函数里写一些你要的操作,它就会在1秒内重复做一样的事
 
 
6) 转载:
回调函数,就是由你自己写的。你需要调用另外一个函数,而这个函数的其中一个参数,就
是你的这个回调函数名。这样,系统在必要的时候,就会调用你写的回调函数,这样你就可
以在回调函数里完成你要做的事。
模块A有一个函数foo,它向模块B传递foo的地址,然后在B里面发生某种事件(event)时,通过从A里面传递过来的foo的地址调用foo,通知A发生了什么事情,让A作出相应反应。 那么我们就把foo称为回调函数。
  
例子:
     回调函数是一个很有用,也很重要的概念。当发生某种事件时,系统或其他函数将会自动调用你定义的一段函数。回调函数在windows编程使用的场合很多,比如Hook回调函数:MouseProc,GetMsgProc以及EnumWindows,DrawState的回调函数等等,还有很多系统级的回调过程。本文不准备介绍这些函数和过程,而是谈谈实现自己的回调函数的一些经验。
     之所以产生使用回调函数这个想法,是因为现在使用VC和Delphi混合编程,用VC写的一个DLL程序进行一些时间比较长的异步工作,工作完成之后,需要通知使用DLL的应用程序:某些事件已经完成,请处理事件的后续部分。开始想过使用同步对象,文件影射,消息等实现DLL函数到应用程序的通知,后来突然想到可不可以在应用程序端先写一个函数,等需要处理后续事宜的时候,在DLL里直接调用这个函数即可。  
      于是就动手,写了个回调函数的原形。在VC和 Delphi里都进行了测试
一:声明回调函数类型。
       vc版
              typedef int (WINAPI *PFCALLBACK)(int Param1,int Param2) ;
       Delph版
              PFCALLBACK = function(Param1:integer;Param2:integer):integer;stdcall;
       实际上是声明了一个返回值为int,传入参数为两个int的指向函数的指针。
       由于C++和PASCAL编译器对参数入栈和函数返回的处理有可能不一致,把函数类型用WINAPI(WINAPI宏展开就是__stdcall)或stdcall统一修饰。
二:声明回调函数原形
       声明函数原形
      vc版
               int WINAPI CBFunc(int Param1,int Param2);
       Delphi版
          function CBFunc(Param1,Param2:integer):integer;stdcall;            
      以上函数为全局函数,如果要使用一个类里的函数作为回调函数原形,把该类函数声明为静态函数即可。

三: 回调函数调用调用者
         调用回调函数的函数我把它放到了DLL里,这是一个很简单的VC生成的WIN32 DLL.并使用DEF文件输出其函数名 TestCallBack。实现如下:
              PFCALLBACK  gCallBack=0;

            void WINAPI TestCallBack(PFCALLBACK Func)
           {
                  if(Func==NULL)return;
                  gCallBack=Func;
                  DWORD ThreadID=0;
                  HANDLE hThread = CreateThread(  NULL,  NULL,  Thread1,   LPVOID(0),          &ThreadID );
                   return;
             }
      此函数的工作把传入的 PFCALLBACK Func参数保存起来等待使用,并且启动一个线程。声明了一个函数指针PFCALLBACK gCallBack保存传入的函数地址。
四: 回调函数如何被使用:
          TestCallBack函数被调用后,启动了一个线程,作为演示,线程人为的进行了延时处理,并且把线程运行的过程打印在屏幕上.
本段线程的代码也在DLL工程里实现
      ULONG  WINAPI Thread1(LPVOID Param)
     {

             TCHAR Buffer[256];
             HDC hDC = GetDC(HWND_DESKTOP);
             int Step=1;
             MSG Msg;
              DWORD StartTick;
        //一个延时循环
             for(;Step<200;Step++)
             {
                        StartTick = GetTickCount();
                  /*这一段为线程交出部分运行时间以让系统处理其他事务*/
                       for(;GetTickCount()-StartTick<10;)
                         {
                                 if(PeekMessage(&Msg,NULL,0,0,PM_NOREMOVE) )
                                 {
                                   TranslateMessage(&Msg);
                                   DispatchMessage(&Msg);
                                   }
                           }                               
                      /*把运行情况打印到桌面,这是vcbear调试程序时最喜欢干的事情*/
           sprintf(Buffer,"Running %04d",Step);
                         if(hDC!=NULL)
                                  TextOut(hDC,30,50,Buffer,strlen(Buffer));
                   }

                /*延时一段时间后调用回调函数*/ 
                (*gCallback)(Step,1);

                 /*结束*/
                   ::ReleaseDC (HWND_DESKTOP,hDC);
                  return 0;
      }
五:万事具备
        使用vc和Delphi各建立了一个工程,编写回调函数的实现部分
       VC版
     int WINAPI CBFunc(int Param1,int Param2)
       {
               int res= Param1+Param2;
             TCHAR Buffer[256]="";
            sprintf(Buffer,"callback result = %d",res);
            MessageBox(NULL,Buffer,"Testing",MB_OK);  //演示回调函数被调用
             return res;           
       }  

         Delphi版
          function CBFunc(Param1,Param2:integer):integer;
          begin
                  result:= Param1+Param2;
                  TForm1.Edit1.Text:=inttostr(result);    / /演示回调函数被调用
           end;
       
       使用静态连接的方法连接DLL里的出口函数 TestCallBack,在工程里添加 Button( 对于Delphi的工程,还需要在Form1上放一个Edit控件,默认名为Edit1)。
        响应ButtonClick事件调用 TestCallBack

              TestCallBack(CBFunc) //函数的参数CBFunc为回调函数的地址

        函数调用创建线程后立刻返回,应用程序可以同时干别的事情去了。现在可以看到屏幕上不停的显示字符串,表示dll里创建的线程运行正常。一会之后,线程延时部分结束结束,vc的应用程序弹出MessageBox,表示回调函数被调用并显示根据Param1,Param2运算的结果,Delphi的程序edit控件里的文本则被改写成Param1,Param2 的运算结果。
        可见使用回调函数的编程模式,可以根据不同的需求传递不同的回调函数地址,或者定义各种回调函数的原形(同时也需要改变使用回调函数的参数和返回值约定),实现多种回调事件处理,可以使程序的控制灵活多变,也是一种高效率的,清晰的程序模块之间的耦合方式。在一些异步或复杂的程序系统里尤其有用 -- 你可以在一个模块(如DLL)里专心实现模块核心的业务流程和技术功能,外围的扩展的功能只给出一个回调函数的接口,通过调用其他模块传递过来的回调函数地址的方式,将后续处理无缝地交给另一个模块,随它按自定义的方式处理。
      本文的例子使用了在DLL里的多线程延时后调用回调函数的方式,只是为了突出一下回调函数的效果,其实只要是在本进程之内,都可以随你高兴可以把函数地址传递来传递去,当成回调函数使用。
       这样的编程模式原理非常简单单一:就是把函数也看成一个指针一个地址来调用,没有什么别的复杂的东西,仅仅是编程里的一个小技巧。至于回调函数模式究竟能为你带来多少好处,就看你是否使用,如何使用这种编程模式了。
另外的解释:cdxiaogan
msdn上这么说的:
有关函数指针的知识
使用例子可以很好地说明函数指针的用法。首先,看一看 Win32 API 中的 EnumWindows 函数:
Declare Function EnumWindows lib "user32" _
(ByVal lpEnumFunc as Long, _
ByVal lParam as Long ) As Long
EnumWindows 是一个枚举函数,它能够列出系统中每一个打开的窗口的句柄。EnumWindows 的工作方式是重复地调用传递给它的第一个参数(lpEnumFunc,函数指针)。每当 EnumWindows 调用函数,EnumWindows 都传递一个打开窗口的句柄。
在代码中调用 EnumWindows 时,可以将一个自定义函数作为第一个参数传递给它,用来处理一系列的值。例如,可以编写一个函数将所有的值添加到一个列表框中,将 hWnd 值转换为窗口的名字,以及其它任何操作!
为了表明传递的参数是一个自定义函数,在函数名称的前面要加上 AddressOf 关键字。第二个参数可以是合适的任何值。例如,如果要把 MyProc 作为函数参数,可以按下面的方式调用 EnumWindows:
x = EnumWindows(AddressOf MyProc, 5)
在调用过程时指定的自定义函数被称为回调函数。回调函数(通常简称为"回调")能够对过程提供的数据执行指定的操作。
回调函数的参数集必须具有规定的形式,这是由使用回调函数的 API 决定的。关于需要什么参数,如何调用它们,请参阅 API 文档。

我谈一下自己对回调函数的一点理解, 不对的地方请指教.
    我刚开始接触回调时, 也是一团雾水.很多人解释这个问题时, 总是拿API来举例子, 本来菜鸟最惧怕的就是API, ^_^. 回调跟API没有必然联系.
    其实回调就是一种利用函数指针进行函数调用的过程.
   
    为什么要用回调呢?比如我要写一个子模块给你用, 来接收远程socket发来的命令.当我接收到命令后, 需要调用你的主模块的函数, 来进行相应的处理.但是我不知道你要用哪个函数来处理这个命令,  我也不知道你的主模块是什么.cpp或者.h, 或者说, 我根本不用关心你在主模块里怎么处理它, 也不应该关心用什么函数处理它...... 怎么办?
    使用回调.
    我在我的模块里先定义回调函数类型, 以及回调函数指针.
    typedef void (CALLBACK *cbkSendCmdToMain) (AnsiString sCmd);
    cbkSendCmdToMain    SendCmdToMain;
    这样SendCmdToMain就是一个指向拥有一个AnsiString形参, 返回值为void的函数指针.
    这样, 在我接收到命令时, 就可以调用这个函数啦.
    ...
    SendCmdToMain(sCommand);
    ...
    但是这样还不够, 我得给一个接口函数(比如Init), 让你在主模块里调用Init来注册这个回调函数.
    在你的主模块里, 可能这样
    void CALLBACK YourSendCmdFun(AnsiString sCmd);  //声明
    ...
    void CALLBACK YourSendCmdFun(AnsiString sCmd);  //定义
    {
        ShowMessage(sCmd);
    }
    ...
    调用Init函数向我的模块注册回调.可能这样:
    Init(YourSendCmdFun, ...);
    这样, 预期目的就达到了.

    需要注意一点, 回调函数一般都要声明为全局的. 如果要在类里使用回调函数, 前面需要加上 static  , 其实也相当于全局的.

 

Google