<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[ponder008的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/ponder008</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; ponder008]]></copyright><item><title><![CDATA[[转载]Java中abstract和interface的区别]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/7257077</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/7257077</guid><author>ponder008</author><pubDate>Tue, 14 Feb 2012 11:32:15 +0800</pubDate><description><![CDATA[来源：http://www.cnblogs.com/gxinliug/archive/2011/04/27/2031246.html


abstract class和interface是Java语言中对于抽象类定义进行支持的两种机制，正是由于这两种机制的存在，才赋予了Java强大的面向对象能力。 abstract class和interface之间在对于抽象类定义的支持方面具有很大的相似性]]></description><category></category></item><item><title><![CDATA[{类名}.this 的用法]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/7219533</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/7219533</guid><author>ponder008</author><pubDate>Mon, 30 Jan 2012 13:44:52 +0800</pubDate><description><![CDATA[{类名}.this 这种用法用来引用当前对象，类似局部静态变量。一般在当前类中内嵌对象中使用它。比如，在MainActivity用到了AlertDialog对象，而在AlertDialog的某个监听函数中，需要用到MainActivity这个对象，就采用这种方式。


public class MainActivity extends Activity {
	// 退出程序提示
	publi]]></description><category></category></item><item><title><![CDATA[Intent的属性]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/7203106</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/7203106</guid><author>ponder008</author><pubDate>Sun, 15 Jan 2012 21:18:50 +0800</pubDate><description><![CDATA[Intent的目的是作为Activity之间的消息来传递的。
为了达到这个目的，它有四个属性Action、Data、Extras、Category。

Action作为标识符，代表一个Intent，当一个Activity需要外部协助处理时，就会发出一个Intent，如果一个程序能完成相应功能，只要在intent-filter加上这个这个intent就可以了。Data保存需要传递的数据格式，比]]></description><category></category></item><item><title><![CDATA[python异常信息捕获方法整理归纳]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/7055714</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/7055714</guid><author>ponder008</author><pubDate>Fri, 09 Dec 2011 09:36:25 +0800</pubDate><description><![CDATA[方法一：
try:
....print 1/0
except Exception,con:
....print Exception,":",con
#con可以换成其它的名字

################################

方法二：
try:
....print 1/0
except:
....import traceback
....traceb]]></description><category></category></item><item><title><![CDATA[“即时标记”]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6993727</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6993727</guid><author>ponder008</author><pubDate>Sun, 20 Nov 2011 19:55:05 +0800</pubDate><description><![CDATA[项目需求和原型设计来自于：《Python基础教程》第20章

类图：



相对于原版的代码，主要是把“Filter”的功能从Handler中独立出来了，使得功能模块更加清晰一点。
代码如下：


#encoding=utf-8
#by panda

import re

class filter():
    '''为特定文本添加修饰性标签'''
    patterns =]]></description><category></category></item><item><title><![CDATA[python中神奇的星号]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6936705</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6936705</guid><author>ponder008</author><pubDate>Fri, 04 Nov 2011 17:44:29 +0800</pubDate><description><![CDATA[传递实参和定义形参（所谓实参就是调用函数时传入的参数，形参则是定义函数是定义的参数）的时候，你还可以使用两个特殊的语法：``*`` ** 。
调用函数时使用* **
test(*args)
    * 的作用其实就是把序列 args 中的每个元素，当作位置参数传进去。比如上面这个代码，如果 args 等于 (1,2,3) ，那么这个代码就等价于 test(1, 2, 3) 。
test(*]]></description><category></category></item><item><title><![CDATA[wxPython学习一：基本代码框架]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6919666</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6919666</guid><author>ponder008</author><pubDate>Sun, 30 Oct 2011 21:41:46 +0800</pubDate><description><![CDATA[#encoding=utf-8
#
#by panda
'''wxPython程序基本框架'''

def printInfo(info):
    print unicode(info, 'utf-8').encode('gbk')

import wx
class Frame(wx.Frame):
    pass

class App(wx.App):
    def OnInit(self]]></description><category></category></item><item><title><![CDATA[设计模式总结]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6917006</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6917006</guid><author>ponder008</author><pubDate>Sat, 29 Oct 2011 15:35:11 +0800</pubDate><description><![CDATA[创建型设计模式

这类模式的特质是管理对象的创建过程。 

通常设计总是以使用工厂方法开始，当设计者发现需要更大的灵活性时，设计会向其它创建型模式演化。 






工厂方法模式




单例模式




抽象工厂方法模式




建造者模式




原型模式




简单工厂模式







结构型模式]]></description><category></category></item><item><title><![CDATA[访问者模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6916646</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6916646</guid><author>ponder008</author><pubDate>Sat, 29 Oct 2011 12:49:36 +0800</pubDate><description><![CDATA[访问者模式：表示一个作用于某对象结构中的各元素的操作。它可以使你在不改变各元素的类的前提下定义作用于这些元素的新操作。
访问者模式适用于数据结构相对稳定而基于该数据结构的操作需要经常扩展的系统。因为该模式的优点就是增加新的操作很容易。
#encoding=utf-8
#
#by panda
#访问模式

def printInfo(info):
    print unicode(info,]]></description><category></category></item><item><title><![CDATA[解释器模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6915276</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6915276</guid><author>ponder008</author><pubDate>Fri, 28 Oct 2011 17:19:45 +0800</pubDate><description><![CDATA[解释器模式：给定一个语言，定义它文法的一种表示，并定义一个解释器。这个解释器使用该‘表示’来解释语言中的句子。
应用场景：如果一种特定类型的问题发生的频率足够高，那么可能就值得将该问题的各个实例表述为一个简单语言中的句子。这样就可以构建一个解释器，该解释器通过解释这些句子来解决该问题。比如“正常表达式”。

#encoding=utf-8
#
#by panda
#解释器模式

def pr]]></description><category></category></item><item><title><![CDATA[享元模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6913514</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6913514</guid><author>ponder008</author><pubDate>Fri, 28 Oct 2011 10:47:11 +0800</pubDate><description><![CDATA[享元模式：运用共享技术有效地支持大量细粒度的对象。
内部状态：享元对象中不会随环境改变而改变的共享部分。比如围棋棋子的颜色。
外部状态：随环境改变而改变、不可以共享的状态就是外部状态。比如围棋棋子的位置。

应用场景：程序中使用了大量的对象，如果删除对象的外部状态，可以用相对较少的共享对象取代很多组对象，就可以考虑使用享元模式。
#encoding=utf-8
#
#by panda
#]]></description><category></category></item><item><title><![CDATA[中介者模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6912119</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6912119</guid><author>ponder008</author><pubDate>Thu, 27 Oct 2011 21:12:12 +0800</pubDate><description><![CDATA[中介者模式：用一个中介对象来封装一系列的对象交互。中介者使各对象不需要显式地相互引用，从而使其耦合松散，而且可以独立地改变它们之间的交互。
一般应用于一组对象以定义良好但是复杂的方式进行通信的场合。
优点：降低了各个模块的耦合性。
缺点：中介对象容易变得复杂和庞大。
#encoding=utf-8
#
#by panda
#中介者模式

def printInfo(info):
    p]]></description><category></category></item><item><title><![CDATA[职责链模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6911961</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6911961</guid><author>ponder008</author><pubDate>Thu, 27 Oct 2011 20:27:27 +0800</pubDate><description><![CDATA[职责链模式：将能处理请求的对象连成一条链，并沿着这条链传递该请求，直到有一个对象处理请求为止，避免请求的发送者和接收者之间的耦合关系。


#encoding=utf-8
#
#by panda
#职责连模式

def printInfo(info):
    print unicode(info, 'utf-8').encode('gbk')

#抽象职责类
class Manager()]]></description><category></category></item><item><title><![CDATA[命令模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6908304</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6908304</guid><author>ponder008</author><pubDate>Wed, 26 Oct 2011 19:35:14 +0800</pubDate><description><![CDATA[命令模式：将一个请求封装为一个对象，从而使你可用不同的请求对客户进行参数化；支持对请求排队、记录请求日志，以及可撤销的操作。

优点：把请求一个操作的对象与知道怎么执行一个操作的对象分隔开。


#encoding=utf-8
#
#by panda
#命令模式

def printInfo(info):
    print unicode(info, 'utf-8').encode(']]></description><category></category></item><item><title><![CDATA[桥接模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6908153</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6908153</guid><author>ponder008</author><pubDate>Wed, 26 Oct 2011 18:21:50 +0800</pubDate><description><![CDATA[桥接模式：将系统抽象部分与它的实现部分分离，使它们可以独立地变化。
由于目标系统存在多个角度的分类，每一种分类都会有多种变化，那么就可以把多角度分离出来，让它们独立变化，减少它们之间的耦合。


#encoding=utf-8
#
#by panda
#桥接模式

def printInfo(info):
    print unicode(info, 'utf-8').encode('g]]></description><category></category></item><item><title><![CDATA[单例模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6905293</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6905293</guid><author>ponder008</author><pubDate>Tue, 25 Oct 2011 21:04:30 +0800</pubDate><description><![CDATA[单例模式：保证一个类仅有一个实例，并提供一个访问它的全局访问点。

实现“某个类只有一个实例”途径：
1、让一个全局变量使得一个对象被访问，但是它不能防止外部实例化多个对象。
2、让类自身负责保存它的唯一实例。这个类可以保证没有其他实例可以被创建。即单例模式。

多线程时的单例模式：加锁——双重锁定。

饿汉式单例类：在类被加载时就将自己实例化（静态初始化）。其优点是躲避了多线程访]]></description><category></category></item><item><title><![CDATA[迭代器模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6903273</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6903273</guid><author>ponder008</author><pubDate>Tue, 25 Oct 2011 11:25:24 +0800</pubDate><description><![CDATA[迭代器模式：提供一种方法顺序访问一个聚合对象中的各个元素，而又不暴露该对象的内部表示。
python内置支持这种模式，所以一般来说，不用自己写，

#encoding=utf-8
#
#by panda
#迭代器(Iterator)模式

def printInfo(info):
    print unicode(info, 'utf-8').encode('gbk')

#迭代器抽象类]]></description><category></category></item><item><title><![CDATA[组合模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6901496</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6901496</guid><author>ponder008</author><pubDate>Tue, 25 Oct 2011 09:19:04 +0800</pubDate><description><![CDATA[组合模式：针对“部分-整体”的层次结构，使得用户对单个对象和组合对象的使用具有一致性。
#encoding=utf-8
#
#by panda
#组合模式


def printInfo(info):
    print unicode(info, 'utf-8').encode('gbk')

#Component：公司抽象类
class Company:
    name = '']]></description><category></category></item><item><title><![CDATA[备忘录模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6899680</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6899680</guid><author>ponder008</author><pubDate>Mon, 24 Oct 2011 09:57:12 +0800</pubDate><description><![CDATA[备忘录模式：在不破坏封装性的前提下，捕获一个对象的内部状态，并在该对象之外保存这个状态。这样以后就可将该对象恢复到原先保存的状态。
跟原型模式很像，不过在原型模式中保存对象的一切，而备忘录模式中只保存恢复时需要的数据。


#encoding=utf-8
#
#by panda
#备忘录模式


def printInfo(info):
    print unicode(info, 'u]]></description><category></category></item><item><title><![CDATA[适配器模式(python)]]></title><link>https://blog.youkuaiyun.com/ponder008/article/details/6896622</link><guid>https://blog.youkuaiyun.com/ponder008/article/details/6896622</guid><author>ponder008</author><pubDate>Sat, 22 Oct 2011 16:44:29 +0800</pubDate><description><![CDATA[适配器模式：将一个类的接口转换成客户希望的另外一个接口。使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。
应用场景：希望复用一些现存的类，但是接口又与复用环境要求不一致。
分类：类适配器（通过多重继承）、对象适配器。


#encoding=utf-8
#
#by panda
#适配器模式


def printInfo(info):
    print unicode(inf]]></description><category></category></item></channel></rss>