Output of char * Variable

(from http)
A character string is of type char *. Suppose we want to print the value of that pointer,i.e., the memory address of the first
character of that string. But the << operator has been overloaded to print data of type char* as a null-terminated string.
The solution is to cast the pointer to void * (this should be done to any pointer variable the programmer wishes to output as an address.)

Restore Grub Menu


Reinstalling from LiveCD


https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindowsIf you cannot boot from GRUB 2 review the section Boot Problems and Rescue Mode. If a reinstall becomes necessary follow these instructions. Two methods are presented; both require booting from a LiveCD (Ubuntu 9.10, Karmic Koala or later version). If the first method does not work, follow the second method, which is more complex and contains more options and instructions.

SIMPLEST - Copy GRUB 2 Files from the LiveCD

How to load ImageIcon in aJava applet

// To load an ImageIcon in an applet, use this code:
ImageIcon img1 = new ImageIcon(getClass().getResource("a.jpg"));

// The following code doesn't work in an applet
ImageIcon img2 = new ImageIcon("a.jpg");

References of Computer Programming

  1. Algorithms in C++(3rd edition) by Robert Segewick.
  2. C++ Primer (4th edition) by Stanley B.Lippman, Josae Lajoie, Barbra, E. Moo.
  3. C++ How to Program (5th edition) by P.J. Deitel.
  4. Computer Networks (3rd edition) by Andrew S. Tanenbaum.
  5. Computer Systems A Programmer's Perspective By Randal E. Bryant

Spiral Numbers

Print spiral number array like this:

7 8 9 10
6 1 2 11
5 4 3 12

Given coordinates of a point, find the corresponding number residing on it.

There are many solutions to this problem. For example, find the number by looking for the relation(function) between the number and its coordinates. The code below solves the problem without using such kind of relation. Of course, the cost is the increase of running time.

java 乱码的解决方法

打开java控制台,在 java applet就是小程序设置部分java运行时的参数部分,加入如下参数:

-Dfile.encoding=gbk

食物属性(热温凉寒)全览

http://hi.baidu.com/ilikebbs/blog/item/f6c4dbb41105d3748ad4b2cb.html
在治疗妇科病痛经一文中曾说过:女性朋友应少吃反季食物,尽量避免寒性特别是大寒的食物。读过马悦凌老师的《不生病的智慧》一书的朋友可能会记忆深刻,书中特别指出了两个大寒的食物:西瓜和螃蟹。

西瓜之所以为大寒不足为奇,因为这是个典型的夏季才有的水果,西瓜正是为人消渴避暑而生的。可是现在的科技发达了,寒冷冬天也随处可见水果摊摆着一个又一个的大西瓜,冬天本来就是寒冷的季节,如果这种天气再吃上一个西瓜,可谓是外寒加内寒,不仅能导致人易染风寒,而且能够使病状加重,所以冬天严格来说一定要杜绝吃西瓜。

过敏

吃了新鲜果蔬后,是否觉得嘴巴又麻又痒?那你就要小心了,这很可能是过敏的表现。12月13日,《美国新闻与世界报道》撰文指出,在美国,数以万计 的人患有口腔变态反应综合征,即在吃桃子、李子、梨、樱桃,或者红萝卜、芹菜后,会出现过敏的症状,但由于果蔬过敏的危害不如花生、牛奶等,因而容易被人 忽视。

中华医学会变态反应学分会常务委员、北京协和医院变态反应科主任尹佳教授告诉《生命时报》记者,在中国,这种情况也比较普遍。“近年来,我们接 诊的因食用果蔬而过敏的情况越来越多,患者一般会出现口腔水肿、突然憋气的症状,或者眼睛痒,打喷嚏、流鼻涕、等类似鼻炎的表现。”