17. 五月 2012 · Write a comment · Categories: MySql · Tags: ,

这个可以写一个存贮过程,传统想法是写一个循环,然后insert,看了《mysql技术内幕》之后忽然发现还可以这样插入。

这个是利用了INSERT INTO xxx SELECT语句,其实目的就是减少循环插入的次数。

在终端中输入;可以先将语句分隔符换成其他字符。[delimiter] [other char]

mysql> create procedure createNums(max int unsigned)
-> begin
-> declare i int unsigned default 1;
-> truncate table nums;
-> insert into nums select i;
-> while i*2<max do
-> begin
-> insert into nums(a) select a+i from nums;
-> set i=i*2;
-> end;
-> end while;
-> delete from nums where a>max;
-> end;
-> ?

More »

11. 五月 2012 · 1 comment · Categories: MySql, PHP · Tags:

原有[client] default-character-set=utf8 不变

[mysqld] 变更为character_set_server=utf8

04. 五月 2012 · 2 comments · Categories: Linux, 转载 · Tags:

用惯了ubuntu经典桌面,升级到11.10版本之后很不习惯,左边做了一栏的工具图标,还是习惯了。自己的Docky方式。
下面是参考了ubuntu中文论坛一篇帖子,感谢作者的分享,链接地址

1、安装GNOME 3

sudo apt-get install gnome-shell
sudo apt-get install gnome-tweak-tool
sudo apt-get install gnome-themes*
(或者简单的选择 sudo apt-get install gnome-themes-standard)

如果希望自动登录,这时候可以做的是:
自动登入GNOME SHELL CLASSIC:
sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-classic

如果喜欢GNOME3,就
sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell

2、删除UNITY:
sudo apt-get -y –auto-remove purge unity
sudo apt-get -y –auto-remove purge unity-common
sudo apt-get -y –auto-remove purge unity-lens*
sudo apt-get -y –auto-remove purge unity-services
sudo apt-get -y –auto-remove purge unity-asset-pool

### 注意:不能用 sudo apt-get –auto-remove purge unity*,看软件包列表里,有不少跟UNITY无关的也列出了。
而且 unity-greeter 必须保留。如果删了,自己蹲墙边哭一会儿再想办法。###

Zend Framework 的类命名总是对应于其所属文件的目录结构的,ZF 标准库的根目录是 “Zend/”,ZF 特别(extras)库的根目录是 “ZendX/”,所有 Zend Framework 的类在其下按等级存放。

类名只允许有字母数字字符,在大部分情况下不鼓励使用数字。下划线只允许做路径分隔符;例如 Zend/Db/Table.php 文件里对应的类名称是 Zend_Db_Table。

如果类名包含多个单词,每个单词的第一个字母必须大写,连续的大写是不允许的,例如 “Zend_PDF” 是不允许的,而 “Zend_Pdf” 是可接受的。

这些约定为 Zend Framework 定义了一个伪命名空间机制。如果对开发者在他们的程序中切实可行,Zend Framework 将采用 PHP 命名空间特性(如果有的话)。

参见在标准和特别库中类名作为类名约定的例子。 重要: 依靠 ZF 库展开的代码,但又不是标准或特别库的一部分(例如程序代码或不是 Zend 发行的库),不要以 “Zend_” 或 “ZendX_” 开头。

More »

19. 四月 2012 · Write a comment · Categories: MySql · Tags:

[intrinsic column flags]

- PK: primary key (column is part of a pk)
- NN: not null (column is nullable)
- UQ: unique (column is part of a unique key)
- AI: auto increment (the column is auto incremented when rows are inserted)

[additional data type flags, depend on used data type]
- BIN: binary (if dt is a blob or similar, this indicates that is binary data, rather than text)
- UN: unsigned (for integer types, see docs: “10.2. Numeric Types”)
- ZF: zero fill (rather a display related flag, see docs: “10.2. Numeric Types”)

10. 四月 2012 · Write a comment · Categories: Linux · Tags: ,

清除PHP的目录 #find -name “PHP”

后。。。#PHP -v   还全部都在。。。

干掉/usr/local/bin/目录下的

#rm -rf ./php ./pgp-cgi ./php-config ./php-size

#PHP -v

bash: php: command not found

安静了。。。

05. 四月 2012 · Write a comment · Categories: .NET · Tags: ,

         工厂模式在我们的项目当中会被频繁使用,这主要是因为他解决了关键字new所引发的类与类之间的依赖。或者说通过工厂能够很好的将类与类解耦。

         假设我们是一家手机制造商,好很多品牌的手机都在我们这里下单,进行批量生产制造。其中有Nokia、HTC、Samsung。我要获得一部三星手机。这个程序可以如何写呢? More »

30. 三月 2012 · 1 comment · Categories: Windows Phone · Tags: ,

随着“撸妹”在欧洲的畅销,心里也怪痒痒的,正好公司也开始准备介入移动应用市场。趁此机会好好学习一番。

准备工作:

1、Visual Studio 2010 sp1

2、Windows Phone SDK7.1

More »

21. 三月 2012 · Write a comment · Categories: .NET · Tags:

         在.NET中,装箱和拆箱是一组针对值类型转换成引用类型,引用类型转换为值类型的术语。

         我们都知道在.NET中内存是分为堆栈和托管堆的,堆栈存放的是值类型的变量,托管堆中存储的是引用类型的对象。而装箱和拆箱是在两种类型之间发生转换的时候发生的。譬如如下代码

1
2
3
int x = 1;
 
Object o =x;

         int x = 1;执行这句代码的时候x的值是分配在堆栈当中的。而Object我们都知道他是引用类型,这时CLR会对x进行装箱操作,将堆栈中的数据放置在托管堆中,由一个名为”o”的引用指向该对象。这个过程称为装箱,而拆箱是执行相反的操作。如int y = (int)o;可以看一下下面的一段程序。 More »

16. 三月 2012 · Write a comment · Categories: .NET · Tags:

         观察者模式(Observer),既观察者根据被观察者“内容”上的改变而做出一系列响应,且被观察者以及观察者之间的一对多的松散耦合关系。

         出版社问题:

                   出版社(Publisher)每天都在发布两种刊物《时尚周刊》、《大众软件》,刊物都是以批发的形式送到书店手里,书店每一段时间都能得到一批当期的刊物进行零售。书店有新华书店、地坛书店等,这个流程应该怎么设计呢? More »