现在的位置: 首页 > 综合 > 正文

有趣的小知识

2013年01月06日 ⁄ 综合 ⁄ 共 1781字 ⁄ 字号 评论关闭

这里打算记录一些平时遇到的,大家可能不会太留意,但有趣的小知识。

1:CRLF

CRLF的含义是“carriage return/line feed”,意思就是回车。这是两个ASCII字符,分别排在第十三和第十位。
CR和LF是在计算机终端还是电传打印机的时候遗留下来的东西。电传打字机就像普通打字机一样工作。在每一行的末端,CR命令让打印头回到左边。LF命令让纸前进一行。
虽然使用卷纸的终端时代已经过去了,但是,CR和LF命令依然存在,许多应用程序和网络协议仍使用这些命令作为分隔符。

2: ICMP 和 windows

刚才碰到一个问题: ping同一个网段的一个主机,竟然返回destinationunreachable.害我以为是本机的路由表出了问题排查了很久,后来在这里发现是WIN7ICMP实现没有遵循RFC标准.  实际的情况是子网内做了MAC白名单或者MAC绑定,让我的机子不在列表内对于这种情况,标准的ICMP应该返回time
out
而不是微软的destinationunreachable.


3: CMCC自动转跳登录页面

刚才一个同事连接CMCC后, 打开网页不能自动转跳到CMCC的登录页面. 在网上搜到说可能是手动设置了DNS服务器, 需要改成自动获取. 略一思忖, 哈哈, 原来它们是用DNS劫持去实现这个自动转跳的.  至于验证, 用wireshark抓包就可以了.


4: C语言中的#pragma

来自:http://stackoverflow.com/questions/3791259/where-does-the-word-pragma-come-from

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

According to a US Government-owned(!) document describing the design of Ada: Rationale
for the Design of the Ada® Programming Language
 :

A pragma (from the Greek word meaning action) is used to direct the actions of the compiler in particular ways, but has no effect on the semantics of a program (in general).

I like the (last caveat) there...

This cross references well with on-line greek dictionaries (e.g. as quoted by Martin
York
) that say pragma (πραγμα, as commented on the original question by asveikau) means:

      a. that which has been done, a deed, an accomplished fact

      b. what is done or being accomplished

          .spec. business, a commercial transaction

      c. a matter, question, affair

          .spec. in a forensic sense, a matter at law, case, suit

      d. that which is or exists, a thing

Seems the key to understanding is the word action rather than information.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

抱歉!评论已关闭.