存档

2010年1月 的存档

算法-由先序遍历和中序遍历求后序遍历

2010年1月22日 DarkIce 没有评论

一个很常见的题目。

方法是,取先序遍历的第一个元素,这个就是根节点,然后在中序遍历中查找对应元素,然后中序遍历被分为2部分,就是左右子树。在先序遍历中按相等大小分为两部分,然后分别递归调用该算法。当划分的一部分中只有一个元素时递归结束。

代码用法:编译成可执行程序命名为getpost,在命令行中输入“getpost 先序遍历序列 中序遍历序列”
例如 getpost abdcef bdaefc

代码下载

代码在ubuntu9.04用g++ 4.3.3编译通过,在WindowXP用VS2005编译通过

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/01

算法-基本数据结构

2010年1月22日 DarkIce 没有评论

东西很简单
列举了几个简单的数据结构以及操作,包括栈,队列,链表。其中链表包含两种,一种普通的双链表和带哨兵的双链表。

代码过于简单,不做解释,关于二叉树放到后面写查找树的时候再说。
本来打算在类里面加上迭代子,但想想这个也不是实际用的,仅仅列举算法就够了,加上以后反而看着比较乱。

代码下载

代码在ubuntu9.04用g++ 4.3.3编译通过,在WindowXP用VS2005编译通过

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/02

google中国恢复正常

2010年1月19日 DarkIce 没有评论

具体情况未知。

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/03

分类: 杂谈 标签:

最近事多,放缓更新

2010年1月18日 DarkIce 没有评论

google似乎也没啥新的消息。。。

等忙完这阵再更新,预计下一步是算法的数据结构相关东西,设计模式年前搞定工厂模式和迭代子模式吧

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/04

分类: 杂谈 标签:

google官方博客的feed

2010年1月15日 DarkIce 没有评论

http://feeds.feedburner.com/blogspot/MKuf
看不到blogspot可以看这个

暂时没有谷歌退出的确切消息。

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/05

分类: 杂谈 标签:

设计模式-装饰者模式

2010年1月14日 DarkIce 没有评论

示例按照《Head First 设计模式》给出。
装饰者模式有一个基础类对象和一批装饰品,装饰品动态的将责任附加在对象身上,并且可能扩展其功能。
可以以一个流水线作为例子:一个汽车的框架是一个基础对象,然后向其中添加各类零件,这些零件还提供了新的功能,最后形成一辆汽车。(这个例子存在一点小问题,作为基础类的对象是可以独立存在并运作的,或许可以把基础类比作奥拓,通过装饰最后成了劳斯莱斯?^_^)
UML图如下:
decoratorpattern

所有对象和装饰品都从Component继承而来。对象类ConcreteComponent直接从Component扩展,我们将动态向其中加入新行为。Decorator是装饰品的接口,它包含一个Component。装饰品类中包含Component来记录他所装饰的事物,并且可能提供新的属性(newState),或者新的方法(newBehavior)。

————————cut———————–

代码中是一个计算咖啡价格的例子,每种咖啡(基础对象)和调料(装饰品)都有自己的价格,在计算价格时,每种调料先调用他所修饰的对象取得价格然后再加上自己的价格返回给修饰自己的调料(如果还有的话),从而获得最后的价格。

完整代码下载地址

代码在ubuntu9.04用g++ 4.3.3编译通过,在WindowXP用VS2005编译通过。

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/06

希拉里敦促中国回应Google的声明,将在下周发布新技术帮助全球人民自由访问互联网

2010年1月14日 DarkIce 没有评论

希拉里敦促中国回应Google的声明,将在下周发布新技术帮助全球人民自由访问互联网
2010年1月13日

美国政府对Google威胁退出中国市场的两条回应:

希拉里敦促中国政府回应Google关于知识产权受到攻击的声明
希拉里将会在下周发布一项新技术政策,以帮助全世界的人民访问自由的没有审查的互联网
中国政府对Google威胁退出中国市场的回应:

正在搜集更多信息
很难讲Google是否会退出中国,没人知道
Google的进一步回应:

我们将在未来几天内与中国当局进行讨论
Google昨天在发表声明之前,就有跟美国当局联系,美国当局发言人PJ Crowley说:

每个国家都有义务,不管恶意攻击的用意是什么都要保持网络的安全性,这也包括中国。每个国家都应该对计算机网络进行恶意攻击活动的人负刑事责任。

——————————-cut———————————-

另外看了昨天china daily手机报,以及其他人说的相关报道
号称“政府试图了解谷歌意图”,而对于希拉里的声明也只提了后半部分的新技术而没有提前面的部分。
我只能说,很好很和谐。

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/07

分类: 杂谈 标签:

A new approach to china by google

2010年1月13日 DarkIce 没有评论

A new approach to china
1/12/2010 03:00:00 PM
Like many other well-known organizations, we face cyber attacks of varying degrees on a regular basis. In mid-December, we detected a highly sophisticated and targeted attack on our corporate infrastructure originating from China that resulted in the theft of intellectual property from Google. However, it soon became clear that what at first appeared to be solely a security incident–albeit a significant one–was something quite different.

First, this attack was not just on Google. As part of our investigation we have discovered that at least twenty other large companies from a wide range of businesses–including the Internet, finance, technology, media and chemical sectors–have been similarly targeted. We are currently in the process of notifying those companies, and we are also working with the relevant U.S. authorities.

Second, we have evidence to suggest that a primary goal of the attackers was accessing the Gmail accounts of Chinese human rights activists. Based on our investigation to date we believe their attack did not achieve that objective. Only two Gmail accounts appear to have been accessed, and that activity was limited to account information (such as the date the account was created) and subject line, rather than the content of emails themselves.

Third, as part of this investigation but independent of the attack on Google, we have discovered that the accounts of dozens of U.S.-, China- and Europe-based Gmail users who are advocates of human rights in China appear to have been routinely accessed by third parties. These accounts have not been accessed through any security breach at Google, but most likely via phishing scams or malware placed on the users’ computers.

We have already used information gained from this attack to make infrastructure and architectural improvements that enhance security for Google and for our users. In terms of individual users, we would advise people to deploy reputable anti-virus and anti-spyware programs on their computers, to install patches for their operating systems and to update their web browsers. Always be cautious when clicking on links appearing in instant messages and emails, or when asked to share personal information like passwords online. You can read more here about our cyber-security recommendations. People wanting to learn more about these kinds of attacks can read this U.S. government report (PDF), Nart Villeneuve’s blog and this presentation on the GhostNet spying incident.

We have taken the unusual step of sharing information about these attacks with a broad audience not just because of the security and human rights implications of what we have unearthed, but also because this information goes to the heart of a much bigger global debate about freedom of speech. In the last two decades, China’s economic reform programs and its citizens’ entrepreneurial flair have lifted hundreds of millions of Chinese people out of poverty. Indeed, this great nation is at the heart of much economic progress and development in the world today.

We launched Google.cn in January 2006 in the belief that the benefits of increased access to information for people in China and a more open Internet outweighed our discomfort in agreeing to censor some results. At the time we made clear that “we will carefully monitor conditions in China, including new laws and other restrictions on our services. If we determine that we are unable to achieve the objectives outlined we will not hesitate to reconsider our approach to China.”

These attacks and the surveillance they have uncovered–combined with the attempts over the past year to further limit free speech on the web–have led us to conclude that we should review the feasibility of our business operations in China. We have decided we are no longer willing to continue censoring our results on Google.cn, and so over the next few weeks we will be discussing with the Chinese government the basis on which we could operate an unfiltered search engine within the law, if at all. We recognize that this may well mean having to shut down Google.cn, and potentially our offices in China.

The decision to review our business operations in China has been incredibly hard, and we know that it will have potentially far-reaching consequences. We want to make clear that this move was driven by our executives in the United States, without the knowledge or involvement of our employees in China who have worked incredibly hard to make Google.cn the success it is today. We are committed to working responsibly to resolve the very difficult issues raised.

Posted by David Drummond, SVP, Corporate Development and Chief Legal Officer

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/08

分类: 杂谈 标签: