再读《C语言陷阱与缺陷》

《C Traps and Pitfalls》确实是一本值得细读的书。
国庆假期,不知道不觉又找了出来,看了一会。

1. 从编译器的词法分析器(lexical analyzer)角度去看带问题总是再好不过了。
词法分析器将把程序分析成一个个记号(token), 每一个记号由一个或多个字符组成,
例如 ++, +, --, 甚至关键词之类,他们在编译时具有一个(相关的)统一的意义。

从这个角度,可以发现,例如 "x= y/*z" 会出现注释z的情况。 陈旧的编译器会觉得 "a=/*b" 是 "a /= (*b);"
而 += 符号则是由两个记号组成,特别的 a + /*you know it*/ = b 编译器在处理时认为是 a +=b
而特别的 a -(空格)> b 是非法的。

2. 关于(*(void(*)())0)();的若干问题。 这个博客里搜索"C语言陷阱与缺陷",我曾经有提到过。

3. 优先级的问题总让人头疼,如果一时不确定,就用括号处理。如果可以,就去查手册吧。这里不再叙述。
彩蛋: z = a
							
发表在 C, 编程 | 标签为 | 留下评论

With Me – Sum 41 【Gossip Girl Season 1】

–With Me
Lyrics By Miuc
继续阅读

发表在 未分类 | 留下评论

编程大师如是说… –《编程之道》

The Silent Void
Book One
Thus spake the master programmer:
编程大师如是说:
继续阅读

发表在 编程 | 标签为 , , , | 留下评论

WordPress 后台修改数据库密码

上传编写的php文件,命名wordpress-pswd.php
在浏览器里访问,修改密码提交


	
set admin password:
users." SET user_pass= '" .md5($_POST['emergency_pass'])."' WHERE User_login = 'admin'"; $link = $wpdb->query($sql); wp_redirect(' wp-login.php'); exit(); } ?>

发表在 博客, 网络 | 标签为 , | 留下评论

Vanish @ CS. Washington

Vanish: Increasing Data Privacy With Self-Destruting Data
Abstract

… To protect the privacy of past, archived data  …. Become unreadable after a userspecified time.  … Even attacker obtains both a cached copy of that data and user’s cryptographic keys and passwords.

1 Introduction

We target … that self-destructs or vanishes automatically after it is no longer useful.  … And Ann would like that all copies of this email – regardless of where stored or cached. … Where user’s sensitive data can persist “in the cloud” indefinitely.

The key insight behind our approach and the corresponding system, called Vanish.

DHTs (Distributed Hash Tables)

Care must be taken in handling and evaluating the mechanisms employed to ensure its security, practicality, and performance.

2 Candidate Approaches

However, we find that none of these approaches are sufficient to achieve the goals enumerated in Section. [ Read file know more ]

3 Goals and Assumptions

To suppot our target …. we introduce the notion of a vanishing data object (VDO).

VDO abstraction and Vanish system make serveral key assumptions:
1.Time-limited value.  VDO encapsulate data that only of value to the user for a limited period of time.
2.Known timeout. When a user encapsulates data in a VDO, she the VDO lifetime.
3.Internet connectivity. users are connected to the Internet when interacting with VDOs.
4.Dispensability under attack. Rather than risk exposure to an adversary, the user perfers the VDO to be destroyed.

We target the following functional goals and properties for Vanish:
1. Destruction after timeout.
2.Accessible until timeout.
3.Leverage existing infrastructures.

//TODO

发表在 系统, 网络 | 标签为 | 留下评论

Read me

这是一篇置顶贴,告示大家本博最近唠叨连篇,
如果有技术类的信息会更新在这里。

发表在 未分类 | 留下评论

深入理解计算机系统——第十二章小结

昨天继续看了一会第三章,暂时不够另写一篇。
晚上OS课时顺手翻了一下十二章,发现大部分在假期做过了,于是先把这章小结。

十二章 网络编程

1. 自己动手写一个服务器, http, mail, ftp 

2. 每个网络应用都是基于客户端-服务器模型,
   这个模型简单的说就是请求事务,服务端处理事务,服务端响应事务,请求端响应事务。

3. 对于主机而言,网络只是一种新的I/O设备. 

4. LAN (Local Area Network) 区域网,以太网(Ethernet),
   集线器(hub),网桥(bridge),桥接以太网(birdged Ethernet)
   路由器(router),internet

5. 互联网思想的精髓在于封装。

6. TCP/IP(Transmission Control Protocal/Internet Protocol 传输控制协议/互联网络协议)
   IP协议提供命名方法,使得传输可能,不可靠。
   UDP扩展传输协议,使得能在进程间传输,不可靠。
   TCP全双工传输协议。可靠(relible)。

7. IP地址和DNS服务器

8. 套接字(socket)和套接字地址(socket address)

9. 套接字接口(socket interface) 是一组用来结合Unix I/O函数创建的网络应用的函数。
   大多数现代操作系统都实现它。

10. 一部分的网络编程函数,这里不详细介绍。

11. Web动态内容提供涉及CGI(Common Getaway Interface, 通用网关接口)
   大体上服务器收到请求后会fork子进程,设置其环境变量(QUERY_STRING, SERVER_PORT等),
   子进程通过Unix dup2将标准输出重定向到和客户端相关联的连接描述符。
   CGI处理Content-type和 Content-length,以及终止的空行。

12. 假如你准备写一个服务器,如果是http服务器,可以参考 
   轻量级 Web 服务器 http://www.ibm.com/developerworks/cn/web/wa-ltwebserv/, 
   其他资料继续从网上找。

13. 假如你写好了一个轻量级服务器,不要太高兴,可以尝试了解apache源码。
   构建一个运行时间很长而而且不崩溃的健壮的web服务器是一件困难的任务。比如处理一些SIGPIPE信号。

14. RFC文档。

发表在 C, 系统, 编程 | 标签为 , | 留下评论

9月5日笔记

  1. vmware  ( 环境独立,便于移植备份,串口信息)
  2. SSH server + putty
  3. 指令集受限
  4. 硬件虚拟化
  5. Vim || Emacs
  6. Vim manual
  7. PCRE 正则表达式
  8. Regexbuddy
  9. GCC 编译开关
  10. . 静态库与动态库
  11. 编译选项 –D –L –I –isystem
  12.   内部参数  __LINE__ __func__
  13. GDB
发表在 编程 | 标签为 | 留下评论

Basileia

心在何方,人便在何方。

发表在 唠叨 | 留下评论

[科普]存储单位

BB:
  Brontobyte 一千亿亿亿字节
  计算机的存储单位
  位 bit (比特)(Binary Digits):存放一位二进制数,即 0 或 1,最小的存储单位。
  字节 byte:8个二进制位为一个字节(B),最常用的单位。
  计算机存储单位一般用B,KB,MB,GB,TB,EB,ZB,YB,BB来表示,它们之间的关系是:
  1KB (Kilobyte 千字节)=1024B,
  1MB (Megabyte 兆字节 简称“兆”)=1024KB,
  1GB (Gigabyte 吉字节 又称“千兆”)=1024MB,
  1TB (Trillionbyte 万亿字节 太字节)=1024GB,其中1024=2^10 ( 2 的10次方),
  1PB(Petabyte 千万亿字节 拍字节)=1024TB,
  1EB(Exabyte 百亿亿字节 艾字节)=1024PB,
  1ZB (Zettabyte 十万亿亿字节 泽字节)= 1024 EB,
  1YB (Jottabyte 一亿亿亿字节 尧字节)= 1024 ZB,
  1BB (Brontobyte 一千亿亿亿字节)= 1024 YB.
  注:“兆”为百万级数量单位。
  附:进制单位全称及译音
  yotta, [尧]它, Y. 10^21,
  zetta, [泽]它, Z. 10^18,
  exa, [艾]可萨, E. 10^15,
  peta, [拍]它, P. 10^12,
  tera, [太]拉, T. 10^9,
  giga, [吉]咖, G. 10^6,
  mega, [兆],M. 10^3

发表在 系统, 网摘 | 标签为 | 留下评论