Green Energy

[Meten upgrade composition]
With the rapid development of science and economic, the Earth is now suffering from heavy energy consumption and pollution. Global warming is not just a term but we indeed face the extreme weather more frequently than 20 years ago. The main reason of global warming is the release of heat keeping gases which are well known CO2 and CH4. These gases mostly come from energy making by burning resources like oil which are called “Unrenewable resources”.

According to Figure 1, by the end of 2008, nearly 3/4 of the energy supply in the world comes from oil, coal, and natural gas. These products have become more expensive than two decades ago and the price is still growing year after year. Without other replaceable resources, countries will be ended as a result of fighting for energy. People in the world has realized this problem and started researches on eco-friendly, renewable energy which is normally termed “Green Energy” or “Green Power”. Large hydropower, biomass heating power, solar collector power and wind power are the four largest portions in renewable energy supply.

Figure Renewable energy
Hydropower station uses water level to produce power. A dam is usually built to stop water in order that the water level can go higher. Hydropower does not contribute significant CO2 and “can be far less expensive than electricity generated from fossil fuels or nuclear energy” (Modern Usage, Hydropower, Wikipedia). And it is easy to save the power by stopping the water when power consumption is not high. Although hydropower contributes half of the whole renewable energy, the environmental impacts of the dam are considered more and more in recent years. The eco-system is changed; fishes disappear; a large number of people have to move to other places; historical heritages will keep underwater forever or will have to move higher; and researchers have found many disasters may have some relations with the big dam.

Figure Three gorges dam
Biomass heating power is an old and traditional way to produce power. When fire wood, it produces power. This kind of energy releases green house gases into air. Should it be green energy? Scientists have found that wood burning does not release any more CO2 than let it be rotten. It just releases what trees absorbed. This is so called carbon cycle. And the fire is the solar energy trees stored. Though wood burning is green, the way of transportation of wood does produce more greenhouse gas.


Figure Wood burning ** Solar power is the most natural, costless, zero CO2 power. All of our energy initially comes from the sun. Two main methods are commonly used: solar cells generate electricity directly and solar heat to boil the water to steam then the steam drives the turbine to produce electricity. The first way can be used widely in housing power supply, car battery charging or even aerospace although it largely depends on the sunshine. The second way is more efficient and scientists have already found the way to store the power. The cost and unmovable are the main drawbacks of solar heat power.

**Figure Giant photovoltaic array


Figure Solar heat power
Wind power is growing rapidly with the capacity from 74GW in 2006 to 121GW in 2008 globally. European countries like Denmark, Spain, Portugal, and Germany had a ration of above 5% of energy from wind power. Not only can the wind power farm be built on the land, it also can be on the sea. The sea wind provides more stable and powerful wind than on the land. The main challenge is how to store the power because wind is not stable.


Figure Wind power
These green sources are mainly used in large scale power stations to produce electricity. But cars cannot eat electricity directly and the process of saving the electricity to battery and releasing it to make car move is not mature; they need a kind of replacement. Scientists are making progress on a new kind of oil which is bio-fuel, so traditional engines can produce power directly from this oil without any modification. In development of this fuel, scientists must balance the total energy outcome and environmental cost.

Figure Sugar cane can be used as a bio-fuel
The sources of first generation of bio-fuel are corn, bean and cane which can use mature technology to make bio-fuel. But it will not last long because there’s no enough farms to satisfy the need which is growing by 10% every year. Scientists are also concerning about the whole carbon release from the beginning of the planting to the final product. The second generation bio-fuel is on the way, which mainly uses grasses to produce bio-fuel and could be more productive and environmentally friendly.

In conclusion, though classical oil resources are still occupying the main energy market, new green energy technologies are now taking fast lane. These technologies will finally give the earth a bright, clean future.

metaWeblog同步博客遇到的问题

最近有一个迫切的需求,需要同步几个博客。目前我有的博客是本站,还有hesicong.cnblogs.com和www.csdn.net/hesicong共三个。其后两个由于各种问题长久以来没有得到更新。我的需求就是写一个软件能够将wordpress的文章同步到cnblogs和csdn(成为次博客)。对于主次博客都有的文章修改次博客为主博客内容,对于次博客没有的文章按照时间新建一个。从而实现博客同步。

技术上使用metaWeblog就可以实现上述目的,选用python的xmlrpclib可以方便的进行xmlrpc操作。做一个控制台的小程序足够了我使用了。

然后开始技术实验,发现:

  1. wordpress支持metaWeblog很好,可以实现所有的功能。从wordpress可以通过metaWeblog.getRecentPosts函数得到所有的文章。
  2. cnblogs也支持metaWeblog,也支持的很好。cnblogs也支持我的语法高亮。但遗憾的是:第一:metaWeblog.getRecentPosts函数最多能够返回100个文章。而我的cnblogs目前有230篇文章,很显然,cnblogs限制了文章数量;第二:metaWeblog.newPost函数即便Post结构中有dateCreated,但cnblogs的主界面中依然按照当前时间计算,造成文章时间对不上号,顺序混乱。
  3. csdn就是个垃圾,metaWeblog表面上支持,暗地里出问题。metaWeblog.getRecentPosts,metaWeblog.editPost都无法用,提示User not exist。仅有metaWeblog.newPost可以用,但csdn的blog的语法高亮无法用,页面很难看。

所以,想实现我的目的通过metaWeblog看来是没希望了。除非cnblogs调整文章数量限制,csdn希望从垃圾变成战斗机了。

附我写的一个测试代码,不完善,仅作为参考:

import xmlrpclib

class Metablog:
def __init__(self, url, username, password):
self.username=username
self.password=password
self.url=url
self.server=xmlrpclib.ServerProxy(url)
self.posts=None

def getAllPosts(self):
print "Getting all posts from "+self.url
self.posts=self.server.metaWeblog.getRecentPosts('', self.username, self.password, 9999999)
print "found "+ str(len(self.posts)) +" posts"
return self.posts;

def getAllPostTitle(self):
if self.posts==None:
self.getAllPosts()

ret=dict()
for post in self.posts:
ret[post["postid"]]=post["title"]

return ret

def getPost(self, id):
for post in self.posts:
if post["postid"]==id:
return post

return None

def newPost(self, post):
self.server.metaWeblog.newPost('', self.username, self.password, post, True)

def editPost(self,postid, post):
self.server.metaWeblog.editPost(postid, self.username, self.password, post, True)

def delPost(self, postid):
self.server.metaWeblog.deletePost('',postid, self.username, self.password, True)

def syncBlog(b1, b2):
b1Titles=b1.getAllPostTitle()
b2Titles=b2.getAllPostTitle()
for key1,value1 in b1Titles.iteritems():
print "Blog1 title: "+value1
for key2,value2 in b2Titles.iteritems():
print "tBlog2 title: "+value2
if value1==value2:
print "Syncing, blog 2 postid="+key2
b2.editPost(keys2, b1.getPost(key1))
break

print "Blog2 has no article equal to title :"+value1
print "Add new "
b2.newPost(b1.getPost(key1))

print "Done sync"


wpBlog=Metablog("主站地址", "用户名", "密码")
cnBlog=Metablog("从站地址", "用户名", "密码")
syncBlog(wpBlog, cnBlog)

装个WIN7惹了一大帕拉麻烦事情

最近C盘空间已经只有最后10%了,我的习惯是50G的C盘空间只要用得还有5G了,就可以重装了。好吧,也是时候了,前几天下载了WIN7还正愁没有时间装呢。

刻盘,浪费一张DVD;刷BIOS,刷成DELL OEM的,破解正版;重启;进入安装界面。

噩梦来了。

在磁盘分区的时候,由于WIN7需要一个额外的分区,而现在的盘没有更多的空间了,所以简单的可以把C盘删除了再新建就好。我以前用XP的时候就知道微软的分区那是一个造孽,一旦以你的分区稍微有点不标准就会把磁盘搞得一塌糊涂。比如我以前装linux的时候,将一个分区搞成了主分区,成了这样:主分区,扩展分区,主分区,扩展分区。然后在XP里面删除一个盘,这下,所有的扩展分区都没了。分区表全部坏了。微软的分区工具就是这么破,要多个心眼。

好了,删除了分区,这下鼠标就一直是圈圈转啊转,转啊转,硬盘灯常亮。没反应了。

重启,使用了Acronis Disk Suite也无法进入到分区,停到了Analyse Partition C这一个阶段。以前的工具对SATA支持不好,就像“经典”的Partition Magic,都不太好使。反正这样那样的工具都不行,好吧,那就用Partition Magic试试。嘿,还好,找到硬盘了,给我说有一个分区错误,提示说要重启看结果。我心想这下好了,修正吧。重启,傻眼了。

Win7系统安装进不了;光盘启动的XPE系统进入不了,硬盘灯常亮;Linux系统无法mount磁盘分区;几种DOS系统均无法看到Starting DOS,直接死到。好吧,这下没系统可以用了,PQ也进不了,几乎所有的工具都被无敌了。拆下来放到老爸的机器上看看行不行。

在XP里面直接挂上硬盘(SATA可以热拨插的),提示驱动程序无法正确加载。我郁闷了。好吧,重启,照样不能启动。试了很多次,也是如此。放弃了。

我都想哭了,装了WIN7就这么恼火?把以前的老工具都找出来用用,最后找到了个Ultimate Boot CD中的DOS工具集竟然能启动,启动后看到个paraman.exe竟然能够识别出分区信息。

根据以往的经验,应该是MBR坏了,造成磁盘无法读取。将MBR全部写零并将C盘的头几百个KB写零。这样造成的结果就是所有的分区都丢失了,不要着急,并不是意味着数据也丢失了。

插入Win7光盘,终于见到了分区界面。显示是一个新硬盘。正常的,因为MBR已经全部损坏了。我的C盘是50G,所以暂时分45G,以免破坏以后分区的数据,装完了再还无损调整分区就可以了。安装完Win7后,第一件事情就是下载亲爱的Acronis Disk Suite。忘了你的什么PQ和GHOST吧,这两个软件已经廉颇老矣,用Acronis出品的Disk Suite和True Image才是王道。

下载的时候可别网上一搜就下载,多半是DEMO版本的,告诉你,到这里来下载:http://58.251.57.206/down?cid=7DA00927EDE61CBDADC9C3DDFFCC304D61E88642&t=2&fmt=&usrinput=acronis%20disk%20director%20suite&dt=2006000&ps=0_0&rt=0kbs&plt=0

可以直接在“迅雷搜索”里面输入“acronis disk director suite”,下载“支持vista的分区工具Acronis Disk Director Suite 独家提供无错汉化版下载Acronis.Disk.Director.Suite.v10.0.2160.by.ANimal!”就可以了。

按照默认的安装。完毕后重启。

使用Acronis Recovery Expert对剩余的空间进行恢复。一般选择Manual和Fast就可以了,因为所有的其他分区都还在,并且NTFS的MFT还是存在的,所以很容易就搜索到了。FAT32格式的我没有试过,估计也可以,只是NTFS在Windows系统中,算是最安全的文件系统了。

不久就会问你找到的分区是不是,看看卷标、大小和剩余空间就可以了。整个过程用不了几分钟就完成。这样数据就完璧归赵了。

总结一下:

. 硬盘硬件能够识别但软件不能识别或硬盘灯常亮,经常是MBR出了问题,解决方法是试图修复或者清除MBR。随后用Acronis Recovery Expert来恢复就可以。不推荐Easy Recovery,只能恢复文件而且多半用不了,并且要占用另外的空间。

. 放弃使用PQ和GHOST之类的老软件。用Acronis一套吧,听说paragon partition manager也很不错,不知道我运行的paraman.exe是不是这个dos工具。

. 多准备点工具,以备不时之需。(刚才那个工具似乎是:http://www.ultimatebootcd.com/download.html 里面的)

解决Open Web Analytics载入文件失败的问题

如果你的wordpress安装在子目录,而使用根目录进行访问,会生成一个.htaccess,但这个规则可能会造成子目录访问失败。我这篇文章[cross id=1987]中也提供了一个解决方案,但我发现我的主页中访问子目录还是存在问题。

所以最终我选择了修改Open Web Analytics插件的方式。主要是调整访问wp-content的路径。

查找到wp-plugin.php包含一句:

define('OWA_PUBLIC_URL', get_bloginfo('url').'/wp-content/plugins/owa/public/');

修改为

define('OWA_PUBLIC_URL', get_bloginfo('wpurl').'/wp-content/plugins/owa/public/');

即可。此时将使用wordpress绝对路径进行访问。

URL Rewrite解决安装访问安装在根目录的Wordpress的子目录出现404的问题

我真不知道这个题目应该怎么写了,呵呵。

问题是这样的,今天装了Open Web Analytics(OWA)后,出现OWA无法用的问题。用Firebug查看网络请求发现OWA请求位于/wp-content/plugins/owa目录中,而直接访问这个目录会出现404错位,因为我的wordpress是装在/b/目录下的,由.htaccess来实现wordpress在根目录中访问。wordpress默认的url-rewrite是这样:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

根据Apache的文章可知,RewriteRule的意思是把所有的请求都给index.php处理。

那么要解决我的问题,我应该添加一条规则

RewriteRule ^wp-content/(.*)$ /b/wp-content/$1 [R]

这样完整的规则是:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wp-content/(.*)$ /b/wp-content/$1 [R]
RewriteRule . /index.php [L]
# END WordPress

可是这样依然无法访问。原因是Apache会遍历每一个规则。查看了《Apache中 RewriteRule 规则参数介绍》一文,重点是这个: ‘last|L’(结尾规则) 立即停止重写操作,并不再应用其他重写规则。它对应于Perl中的last命令或C语言中的break命令。 这个标记用于阻止当前已被重写的URL被后继规则再次重写。 例如,使用它可以重写根路径的URL(‘/‘)为实际存在的URL(比如:’/e/www/‘)。 所以,最终的.htaccess应该这样写:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wp-content/(.*)$ /b/wp-content/$1 [R,L]
RewriteRule . /index.php [L]
# END WordPress

以后再出现这种在wordpress安装目录下子目录无法访问的情况就类似的这样解决。