刚哥的来信

作者:yaya | 时间:2009年5月11日 | 分类 随便写写 | 标签 刚歌 邮件 编程 linux 错误 搞笑 代码 tcp udp 协议 问题 | 1回复

上周信息安全实验课,调试程序的时候出现了奇怪错误。课程结束后,刚哥(自从听他带的一个研究生这样叫他后,我们暗地都这样称呼他)让我将代码发给他看看,帮我检查下。
后来这些天遭遇了XXX事情,Anotion的每个人就差集体上吊了,改光头的光头了,改喝酒的喝醉了,改玩的去玩了。。。
今天才打开邮箱看看邮件。发现有刚哥的回信。
一来就说:你犯了了一个不可饶恕的低级错误
然后看给的c文件。
里面有刚哥给的注释:

    /*你很搞笑,明明是发TCP包,你却是用UDP协议*/

    /*低级错误*/
     //sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
     sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_TCP);

我一直觉得刚哥人很好,最主要的是这种负责精神~真的让人佩服。
我想,这种态度是值得我好好学习的。小小鄙视一下自己了。
 

来,看看好玩的问题

作者:yaya | 时间:2008年10月23日 | 分类 学海无涯 | 标签 缓存 项目 问题 代码 | 0回复

在做缓存问题的时候,有如下代码段:

char timesaveit[]="/home/ran/timeinfo/";
strcat(timesaveit,hashchar);
time_t timepd;
char  bufftime[20];
time(&timepd);
int nowtimefor=timepd;
printf("Look At Me N %d",nowtimefor);
sprintf(bufftime, "%d", nowtimefor);
printf("Look At Me B %s",bufftime);
timefp=fopen(timesaveit,"wb");
fputs(bufftime,timefp);
fclose(timefp);

这样不会出错

但要是把红色一行放到蓝色的下一行,好玩的错误就来了。
运行的时候没有错误,就是得到的bufftime值会很奇怪的,变成了timesaveit的后几位了。

hashchar只是个字符串,没有对bufftime或者timesaveit有过任何关系。

然后就是gdb的调试了。那个断点真要断的有水平才好找出问题来。结果发现写了几行printf来看才发现。(笨啊)

Incorrect syntax near the keyword User

作者:yaya | 时间:2008年7月17日 | 分类 随便写写 | 标签 keyword User 数据库 错误 问题 | 1回复

        不知怎么回事,非要去建立个user表,然后就出错了。网上一捞:

摘自:http://blog.csdn.net/sanking/archive/2007/10/31/1860190.aspx

Today I built one table named 'User' in sqlserver2000 and  found one problem.

When I type select * from User at SQL Query Analyzer, one message displayed as below:

Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'User'.

O…I see "User" is the keyword of sql. So don't build User table into sql. If u must build one table named User.

The query should be  select * from "User"

But If in your java codes or other codes, how to do? I think it must be very complex..so…don't build User table in SQLserver2000.

But if u really must be use User table in programs.

The query statement should be  "select * from \"User\""  (Java)

In fact all the query statement can be "select * from \""+tableName+"\""

图片上传不上了,唉!

作者:hsy | 时间:2008年6月1日 | 分类 随便写写 | 标签 问题 | 0回复

WSAEAFNOSUPPORT10047

作者:yaya | 时间:2008年3月26日 | 分类 学海无涯 | 标签 问题 错误 | 0回复

Address family not supported by protocol family.
An address incompatible with the requested protocol was used. All sockets are created with an associated address family (that is, AF_INET for Internet Protocols) and a generic protocol type (that is, SOCK_STREAM). This error is returned if an incorrect protocol is explicitly requested in the socket call, or if an address of the wrong family is used for a socket, for example, in sendto.

继续出错~~~~

 

  1. 1
  2. 2
  3. 3