一流的创意加三流的执行力,不如三流的创意加一流的执行力
Aug 10

[置顶] 这个博客已经四年了 不指定

空城 , 2010/08/10 00:00 , 心情随笔 , 评论(4) , 引用(0) , 阅读(609) , Via 本站原创
Dec 10

[置顶] 空城个人档案 不指定

空城 , 2008/12/10 03:36 , 乱七八糟 , 评论(30) , 引用(0) , 阅读(1520) , Via 本站原创
Aug 29

百度site:.at 我的域名排第一 不指定

空城 , 2010/08/29 02:32 , 技术 , 评论(65) , 引用(0) , 阅读(617) , Via 本站原创
在百度site:.at时,www.520.at这个域名排第一,比google.at还排前,我想,在中国地区使用.at后缀的域名,可能我的站流量是最高的吧?

点击在新窗口中浏览此图片
Aug 23

有点像URL创建方式的代码 不指定

空城 , 2010/08/23 16:32 , 技术 » delphi , 评论(49) , 引用(0) , 阅读(606) , Via 本站原创
写一段无聊的代码


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, shellapi, ExtCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowMainForm:=false;  //隐藏窗体
shellexecute(handle,'open','www.520.at',nil,nil,sw_shownormal);
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
close;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin

end;

end.

Aug 17
mysql中一个表的一个时间列是int类型,现在想修改这个字段的值,打算可读日期时间格式转成int,然后修改那个值。

这个转换函数就是UNIX_TIMESTAMP,将可读的时间转换成int类型,具体用法:

update xxx_table set xxx_time=UNIX_TIMESTAMP('2006-11-13 13:24:22') where ......

同时介绍一个另一个转换函数:FROM_UNIXTIME,将将时间戳转成常用时间格式



select FROM_UNIXTIME(xxx_time) from xxx_table



mysql将时间戳转成常用时间格式
在mysql中,一个时间字段的存储类型是int(11),怎么转化成字符类型,比方存储为13270655222,需要转化为yyyy -mm-dd的形式

使用 FROM_UNIXTIME函数,具体如下:

FROM_UNIXTIME(unix_timestamp,format)
返回表示 Unix 时间标记的一个字符串,根据format字符串格式化。format可以包含与DATE_FORMAT()函数列出的条目同样的修饰符。
根据format字符串格式化date值。下列修饰符可以被用在format字符串中: %M 月名字(January……December)
%W 星期名字(Sunday……Saturday)
%D 有英语前缀的月份的日期(1st, 2nd, 3rd, 等等。)
%Y 年, 数字, 4 位
%y 年, 数字, 2 位
%a 缩写的星期名字(Sun……Sat)
%d 月份中的天数, 数字(00……31)
%e 月份中的天数, 数字(0……31)
%m 月, 数字(01……12)
%c 月, 数字(1……12)
%b 缩写的月份名字(Jan……Dec)
%j 一年中的天数(001……366)
%H 小时(00……23)
%k 小时(0……23)
%h 小时(01……12)
%I 小时(01……12)
%l 小时(1……12)
%i 分钟, 数字(00……59)
%r 时间,12 小时(hh:mm:ss [AP]M)
%T 时间,24 小时(hh:mm:ss)
%S 秒(00……59)
%s 秒(00……59)
%p AM或PM
%w 一个星期中的天数(0=Sunday ……6=Saturday )
%U 星期(0……52), 这里星期天是星期的第一天
%u 星期(0……52), 这里星期一是星期的第一天
%% 一个文字“%”。

所有的其他字符不做解释被复制到结果中。


如:

SELECT FROM_UNIXTIME(1234567890, '%Y-%m-%d %H:%i:%S')
可以自己指定格式。
Jul 21
Nginx (”engine x”) 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,它已经在该站点运行超过两年半了。Igor 将源代码以类BSD许可证的形式发布。尽管还是测试版,但是,Nginx 已经因为它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名了。
  因为 Nginx 的文档大部分是俄文的,Nginx 的中文维基的目的是帮助使用中文世界的用户安装、配置和交换有关 Nginx 的使用经验。大部分文档源自Aleksandar Lazic 的工作。有关本维基本身的问题请直接询问Cliff Wells 。
  Nginx 可以在大多数 Unix like OS 上编译运行,并有 Windows 移植版。目前 Nginx 的开发版为 0.7.x,稳定版为 0.6.x,历史稳定版为 0.5.x,建议使用 0.6 系列作为生产版本。 Nginx 的源代码使用 2-clause BSD-like license。
  Nginx 的中文维基:http://wiki.codemongers.com/NginxChs
  Nginx 的中文站: http://www.nginx.cn

nginx下的伪静态规则:

PHPCMS:

location / {
###以下为PHPCMS 伪静态化rewrite规则
rewrite ^(.*)show-([0-9]+)-([0-9]+)\.html$ $1/show.php?itemid=$2&page=$3;
rewrite ^(.*)list-([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$2&page=$3;
rewrite ^(.*)show-([0-9]+)\.html$ $1/show.php?specialid=$2;
}

PHPWIND:
location / {
####以下为PHPWind 伪静态化rewrite规则
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
}

WordPress的nginx伪静态规则:

location / {
index index.html index.php;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}

ECSHOP的nginx伪静态规则就比较复杂庞大了:

if (!-e $request_filename)
{
rewrite “^/index\.html” /index.php last;
rewrite “^/category$” /index.php last;
rewrite “^/feed-c([0-9]+)\.xml$” /feed.php?cat=$1 last;
rewrite “^/feed-b([0-9]+)\.xml$” /feed.php?brand=$1 last;
rewrite “^/feed\.xml$” /feed.php last;
rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$” /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$” /category.php?id=$1&brand=$2&page=$3 last;
rewrite “^/category-([0-9]+)-b([0-9]+)(.*)\.html$” /category.php?id=$1&brand=$2 last;
rewrite “^/category-([0-9]+)(.*)\.html$” /category.php?id=$1 last;
rewrite “^/goods-([0-9]+)(.*)\.html” /goods.php?id=$1 last;
rewrite “^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
rewrite “^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$” /article_cat.php?id=$1&page=$2 last;
rewrite “^/article_cat-([0-9]+)(.*)\.html$” /article_cat.php?id=$1 last;
rewrite “^/article-([0-9]+)(.*)\.html$” /article.php?id=$1 last;
rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html” /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html” /brand.php?id=$1&cat=$2&page=$3 last;
rewrite “^/brand-([0-9]+)-c([0-9]+)(.*)\.html” /brand.php?id=$1&cat=$2 last;
rewrite “^/brand-([0-9]+)(.*)\.html” /brand.php?id=$1 last;
rewrite “^/tag-(.*)\.html” /search.php?keywords=$1 last;
rewrite “^/snatch-([0-9]+)\.html$” /snatch.php?id=$1 last;
rewrite “^/group_buy-([0-9]+)\.html$” /group_buy.php?act=view&id=$1 last;
rewrite “^/auction-([0-9]+)\.html$” /auction.php?act=view&id=$1 last;
rewrite “^/exchange-id([0-9]+)(.*)\.html$” /exchange.php?id=$1&act=view last;
rewrite “^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
rewrite “^/exchange-([0-9]+)-([0-9]+)(.*)\.html$” /exchange.php?cat_id=$1&page=$2 last;
rewrite “^/exchange-([0-9]+)(.*)\.html$” /exchange.php?cat_id=$1 last;
}

商城程序shopex的nginx伪静态规则:

location / {
if (!-e $request_filename) {
rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
}
}

Jul 8

MYSQL重复记录查询 不指定

空城 , 2010/07/08 01:28 , 技术 » mysql , 评论(54) , 引用(0) , 阅读(656) , Via 本站原创
1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断
select * from people
where peopleId in (select   peopleId  from   people  group  by   peopleId  having  count(peopleId) > 1)

2、删除表中多余的重复记录,重复记录是根据单个 字段(peopleId)来判断,只留有rowid最小的记录
delete from people
where peopleId  in (select   peopleId  from people  group  by   peopleId   having  count(peopleId) > 1)
and rowid not in (select min(rowid) from   people  group by peopleId  having count(peopleId )>1)

3、 查找表中多余的重复记录(多个字段)
select * from vitae a
where (a.peopleId,a.seq) in   (select peopleId,seq from vitae group by peopleId,seq  having count(*) > 1)

4、删除表中多余的重复记录(多个字段),只留有rowid最小的记录
delete from vitae a
where (a.peopleId,a.seq) in   (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)

5、查找表中多余的重复记录(多个字段),不包含rowid最小的记录
select * from vitae a
where (a.peopleId,a.seq) in   (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
(二)
比方说
在A表中存在一个字段“name”,
而且不同记录之间的“name”值有可能 会相同,
现在就是需要查询出在该表中的各记录之间,“name”值存在重复的项;
Select Name,Count(*) From A Group By Name Having Count(*) > 1
如果还查性别也相同大则如下:
Select Name,sex,Count(*) From A Group By Name,sex Having Count(*) > 1
(三)
方 法一
declare @max integer,@id integer
declare cur_rows cursor local for select 主字段,count(*) from 表名 group by 主字段 having count(*) >; 1
open cur_rows
fetch cur_rows into @id,@max
while @@fetch_status=0
begin
select @max = @max -1
set rowcount @max
delete from 表名 where 主字段 = @id
fetch cur_rows into @id,@max
end
close cur_rows
set rowcount 0

方法二

有两个意义上的重复记录,一是完全重复的记录,也即所有字段均重复的记录,二是部分关键字段重复的记录,比如Name字段重 复,而其他字段不一定重复或都重复可以忽略。

1、对于第一种重复,比较容易解决,使用
select distinct * from tableName

就可以得到无重复记录的结果集。

如果该表需要删除重复的记录(重复记录保留1 条),可以按以下方法删除
select distinct * into #Tmp from tableName
drop table tableName
select * into tableName from #Tmp
drop table #Tmp

发生这种重复的原因是表设计不周产生的,增加唯一索引列即可解决。

2、这类重复问题通常要求保留重复记录中的第一条记录,操作方法 如下

假设有重复的字段为Name,Address,要求得到这两个字段唯一的结果集
select identity(int,1,1) as autoID, * into #Tmp from tableName
select min(autoID) as autoID into #Tmp2 from #Tmp group by Name,autoID
select * from #Tmp where autoID in(select autoID from #tmp2)

最后一个 select即得到了Name,Address不重复的结果集(但多了一个autoID字段,实际写时可以写在select子句中省去此列)

(四) 查询重复
select * from tablename where id in (
select id from tablename
group by id
having count(id) > 1

)
May 16
在用file_get_contents函数采集网站时,有时会遇到明明用浏览器可以看,但就是采不到内容的问题。这很有可能是服务器上做了设置,根据 User_agent判断是否为正常的浏览器请求,默认PHP的file_get_contents函数是不发送ua的,如果要采集这样的网站,我们就要 让PHP模拟浏览器发送UA,这样对方的服务器就会以为我们是用浏览器是浏览,而返回正常的内容。
发送UA方法很简单,在使用file_get_contents函数前加上这一句:


ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; GreenBrowser)');
$url='http://www.baidu.com';
echo $flg=@file_get_contents($url);

其中Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; GreenBrowser)是 IE7 WindowsXP GreenBrowser环境下的UA,可根据需要自行修改成其他的,甚至可以伪装蜘蛛。

Baiduspider+(+http://www.baidu.com/search/spider.htm)       百度蜘蛛User_agent
Sosospider+(+http://help.soso.com/webspider.htm)      SOSO蜘蛛User_agent
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)      GOOGLE蜘蛛User_agent
Mozilla/5.0+(compatible;+Yahoo!+Slurp;+http://help.yahoo.com/help/us/ysearch/slurp)      Yahoo蜘蛛User_agent
Mozilla/5.0 (compatible; YoudaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; )      有道蜘蛛User_agent

分页: 1/52 第一页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]