文章列表
 
您正在查看 "计算机与 internet" 分类下的文章

2011-08-25 16:21

今天遇到了一个非常诡异的事情。就是复制文章到自己网站上时,有时会出现500错误。文章的内容如下:

 

Google Reaches $500 Million Settlement With GovernmentByCLAIRE CAIN MILLER

10:42 p.m. | Updated

Google will pay $500 million to settle federal government charges that it has knowingly shown illegal ads for fraudulent Canadian pharmacies in the United States, the Justice Departmentannouncedon Wednesday.

 

 

 

但是单独复制每一段时,就一点没有问题。结果发现是apache内有一个防止SQL注入的傻逼正则表达式导致的。通过locate找到这个mod名字:modsec2

我这边这个文件叫:/local/apache/conf/modsec2.user.conf (每个电脑可能路径不同)

显然,直接关掉这个mod可能对今后的防注入有害处,所以只能改文件内容了。

 

打开后,找到某段以下内容:

#Generic SQL sigs
SecRule ARGS "((alter|create|drop)[[:space:]]+(column|database|procedure|table)|delete[[:space:]]+from|update.+set.+=)" "id:300015,rev:1,severity:2,msg:'Generic SQL injection protection'"

 

然后注释掉这句即可。

为什么这句话能导致我们500呢,可以看出,这句话会匹配任何满足update.......set.....形式的文章内容。我刚才贴的那段里正好有updated和settle这两个词语,于是就被截断了。什么错都不报遍500内部错误了。由于update和set是两个英语里使用频率非常高的词语,特别是他这样的判断还包括了所有部分匹配这两个词语的单词,并且万一遇到了技术类网站,就是有一句技术讨论包含了SQL语句,那也会导致报错,所以关掉也没啥的。



这个问题是由我所在公司大神sam指导后得知的。


另外,还可以在白名单里(/usr/local/apache/conf/modsec2/whitelist.conf)加入这句:

SecRule SERVER_NAME "xxx.com" phase:1,nolog,allow,ctl:ruleEngine=off

 
2011-04-30 21:51

本来想正儿八经的写一篇比较专业的使用评价的,不过感觉还是胡言乱语的涂几笔比较合适。。好了,就直接开始进入话题吧。

其实在11.04的alpha推出时,我已经有些按耐不住了。unity漂亮的界面让人不禁想到mac系统,而且听说非常精简小巧,速度很快,真是表面大家闺修,实为小家碧玉吖。另外openoffice这个超臃肿的office软件也被剥离了,改用了新的libreoffice。另外unity在介绍上说是为了更好的利用了上网本桌面的空间,操作更人性化。而在xserver方面听说还实验性的放了wayland,但只供开发者尝试。那么多优点,虽然这次的重要更新不多,因为整个从gnome destkop变成了基于gnome的unity desktop,在界面上变化很大,我这个ubuntu界面控在beta1出现时,首次在正式版未发行前就刻盘了。刻完以后我便迫不及待的安装在一台5,6年前买的笔记本上,这个笔记本的配置不太清楚,但也是独立显卡,关于cpu方面,则是非常vintage的奔四1.7G。可能有人有所不知,ubuntu向来被誉为老旧电脑的福音嘛,再说这次的unity听说是非常lightweight,super fast,于是我也没多想,就装了,但是接下来的体验却惨不忍睹。

 

装完本来以为打开来就是华丽丽的unity界面啦,可是登录的时候居然跳出来一句:你的显卡不给力,不能体验unity。我的天啊!我的显卡怎么不给力了!!unity难道要求的配置那么高?!于是我忽然凭第六感想起,我的显卡是nvidia品牌的,这品牌是不提供开源linux驱动的,所以默认是不会装nvidia的驱动的,必须手动安装,那没事,装就装。不过我想ubuntu的小组应该不会连这个都没有考虑到吧,居然直接就归类到显卡差这档,你就不能说清楚么。。这个不多说了,通过一番安装,终于把nvidia的显卡驱动装好了。于是我也如愿以偿的首次接触到了unity 3D!啦啦啦~第一次看到unity的见面,简直就像初次恋爱的少女一般激动,我颤抖着小手朝dock那里摸去,哇…………他华丽丽的伸出那条半透明黑色的dock,里面显示出一大堆默认排在上面的软件,似乎挑逗性的向我示意,让我随便蹂躏之。可是看着这些图标,我实在不知道点啥。=。=作为默认的软件你好歹也给我搞点常用的呢。结果一个home folder,麻痹4个office图标!!聊天工具在哪里?木有!music player呢?木有!shit……我想大多数在家里用ubuntu的用户都是把它当作上网本吧,谁没事在家那么高级开那么多office拼命工作呢!好吧,这不是最最主要的,我于是删除了这些默认的图标,为放上自己常用的软件做准备。

 

对于把常用软件放到dock上的操作流程我是这么思考的:必然是在下面的application列表里打入自己想要的软件,然后拖动到dock上,dock一定会无比小受的吸住这些图标的。个么我就按了那个万恶的applications列表按钮,接着我的机器就卡住了……unity它……撒娇了。。这展开列表需要多少内存啊啊啊居然可以卡住,我有点慌了。。这么点事情都要卡住,我还能做啥么。。我的小本吃的住unity这个高贵哥么。我战战兢兢的输入了软件名称,于是他的图标库噼里啪啦非常牛逼的闪了几下(因为他居然还是每输入一个字母就全部搜索一遍的),马上就又对我翻白眼了。。。又卡住了嘛嘛。。。。经过大概半小时的斗争,我终于把我的dock设置成了理想状态。。。

 

那设置好各种语言后,现在,就上网看看网页吧!俺于是点下了那个漂亮的firefox图标,它以一个非常完美的渐变深深的陷入,又缓缓的恢复出来。哇,真美!此时此刻,随着这图标的渐变渐出,我的内心也终于似乎有了一丝安抚。。啊,我长叹一口气,期盼着firefox窗口填满我的桌面。。。。可是。。。我的firefox呢。。。fuck,没了?!我是不是应该再去点第二次呢,不会就此死机吧。。。就在犹豫的时候,又大概过了2秒,那个窗口终于弹出了,不过我。。。把它关了。因为我想打入中文的搜索时,又卡了,老娘不想陪你这傲娇玩了。

 

卡!整个体验过程糟糕到了飞流直下三千尺的地步!也许你要说是不是我的笔记本配置实在太差了,no no nonono,而且在安装之前的系统,是windows xp,还能玩网游(太高级的网游不行),模拟城市4在上面跑也完全没有问题。所以说unity 3D在某些时候的难伺候程度可能比一个游戏还要厉害!本来是多么的憧憬这番全新的体验,系统却如同僵尸一般寸步难行,我曾经记忆里的ubuntu不是这样的啊,它究竟是怎么了,忽然从一个居家体贴型桌面变成了一个傲娇女王,是什么改变了它的价值观?我不知道,可能现在的操作系统桌面玩的就是华丽吧,3D效果什么要上是必然的,否则就是落伍了。难道要眼看着它这么伤不起,我应该。。?!为了不抛弃它,我决定再给它一个机会。是的,linux的好处就是,他的可选面非常大,虽然默认的桌面系统是unity,不过还有别的选择嘛。如果去选旧界面的话,那就什么都没有改变,除了软件都更新到最新了,那完全没有安装新系统的意义了。我忽然想到一直备受好评的非主流emo系统,xfce,经过一大番无比纠结的unity intercourse之后(前后大概卸载+安装了4次,我有多纠结哦),我毅然写下了命令行,xfce随之安装成功。我一切换,诶!!这非主流emo界面居然还挺对我口味!!蓝色的默认颜色,而不是黑色!不过这不是最重要的,最终要的是他的速度啊!!这才是真正的lightweight系统啊。打开任何窗口都是0.0001秒绝逼的!秒杀有没有!(我承认夸张了。。)这种在被unity便秘后,终于一下子畅快的发泄完了……我觉得让xfce成为如此非主流桌面实在太委屈它了。要论漂亮,每个人都有自己的审美观,可能unity是比xfce更漂亮些,毕竟比较像mac,新潮嘛。比起来xfce的确有点呆板,不过这完全不妨碍这个新欢成为我的宠爱!在这么一场斗争后,我便准备在网上好好夸夸这么个非主流桌面。但是要夸,还得好好的修整一番,因为我这个系统其实是半残不绥的,他的内心虽然已经恢复到了温柔体贴的xfce,可是他的内部软件还是unity下的,这就像是他虽然已经化为体贴的男仆,却仍然用着他那个傲娇女王哥哥的皮鞭。。于是我想到,何不尝试用一下xubuntu呢(基于xfce的ubuntu)。再次刻录了一张盘。(顺便说一句,官方这次对xubuntu的介绍口吻似乎很惋惜似的,说很抱歉因为你选择了xubuntu,所以默认的桌面就不再是unity了。。。)

 

装完了xubuntu,流畅感和原先一样,另外ubuntu给xfce额外设计的theme也很简洁漂亮,并且xfce的xfwm使用的composite是true transparent的,设置也非常非常简单,所以几步就让窗口的透明设置搞定了(我喜欢不用的窗口都半透明状)。所以等到了正式版我仍然很安心的使用着。非常重要的一点是,在安装完了xubuntu他没有提示我的显卡不给力,而是弹出了一个窗口告诉我这个显卡是受限显卡(没有开源软件),必须手动激活,这多体贴啊!完全不像他那个当红哥哥那么傲娇啊!这让我更爱他了。

xubuntu的大多数软件都是基于xfce的,比如terminal emulator用的不是gnome-terminal等。而聊天工具用的是pidgin而不是empathy,我想我可能还是会改到empathy的。常用工具条里也列着firefox,mail,图片编辑软件和音乐播放软件。在office方面使用的是abiword这个更精简的word文档处理软件,对大多数人来说我想也足够用了。一路用下来暂时没有什么问题,唯一比较讨厌的就是他的字体设置了(非主流emo神马的文盲很多的。。不怪他)。曾经我修改字体是在安装了中文字体后,在69-unifont.conf和任何中文的language-selector里改设置的。不过这次不行,几乎改了所有能想到的config文件了,仍然无法让中文的wenquanyi变成默认的汉字字体,他总是优先让一个非常丑的日语哥特字体作为默认汉字字体,其实wenquanyi也是包含日语的,所以作为默认汉字字体是绝对没有问题的。查了好久,终于找到了一个方法,就是在/etc/fonts里创建一个新文件,命名为local.conf,文件内容如下:

<fontconfig>
   <match target="pattern">
      <test qual="any" name="family">
         <string>serif</string>
      </test>
      <edit name="family" mode="prepend" binding="strong">
         <string>Ubuntu</string>
         <string>WenQuanYi Micro Hei</string>
         <string>AR PL UMing CN</string>
         <string>AR PL ShanHeiSun Uni</string>
         <string>Bitstream Vera Serif</string>
         <string>DejaVu Serif</string>
         <string>AR PL UKai CN</string>
         <string>AR PL ZenKai Uni</string>
      </edit>
   </match>
   <match target="pattern">
      <test qual="any" name="family">
         <string>sans-serif</string>
      </test>
      <edit name="family" mode="prepend" binding="strong">
         <string>Ubuntu</string>
         <string>WenQuanYi Micro Hei</string>
         <string>Bitstream Vera Sans</string>
         <string>DejaVu Sans</string>
         <string>WenQuanYi Zen Hei</string>
         <string>AR PL UMing CN</string>
         <string>AR PL ShanHeiSun Uni</string>
         <string>AR PL UKai CN</string>
         <string>AR PL ZenKai Uni</string>
      </edit>
   </match>
   <match target="pattern">
      <test qual="any" name="family">
         <string>monospace</string>
      </test>
      <edit name="family" mode="prepend" binding="strong">
         <string>WenQuanYi Micro Hei Mono</string>
         <string>Bitstream Vera Sans Mono</string>
         <string>DejaVu Sans Mono</string>
         <string>WenQuanYi Zen Hei</string>
         <string>AR PL UMing CN</string>
         <string>AR PL ShanHeiSun Uni</string>
         <string>AR PL UKai CN</string>
         <string>AR PL ZenKai Uni</string>
      </edit>
   </match>
</fontconfig>

把自己喜欢的中文字体优先放在最上面就好了。这里的Ubuntu英文字体放在上面主要是希望英文以ubuntu字体为默认,遇到汉字才用wenquanyi字体。

其他的我还在探索,xfce也有默认的字典,已经安装好了,用的是DICT形式的字典,这个形式的字典几乎各种语言的翻译(除非是非常冷门的)都有,用谷歌搜索一下即可,如果不喜欢查询每个单词时都要上网的话,那还是推荐有名的stardict,具体安装方法相信大多数ubuntu使用者都熟:sudo apt-get install stardict 即可。stardict的字典在新浪的ishare以及stardict的官网都有,两个地方都挺全(官网更全),下载完直接拷贝到/usr/share/stardict/dic/ 打开stardict就能用。这个字典用了好多年了,感觉的确是linux下最好的离线字典了。

 

其他的不多说了,正式版在28日已经发行了。我现在继续用着正式版的xubuntu,简洁、干净。有朋友说现在的操作系统都是追求3d效果的,但我还是希望unity以后也不要为了华丽走的太远,速度是最重要的,如果一个桌面本身就额外的占用了太多的资源和空间,那终究会被人放弃使用的(所以说傲娇也得有个限度),毕竟linux下有太多的选择了,gnome 3也已经发版,又是一个新的选择,听说在新版的fedora中已经默认安装,有兴趣的朋友可以“体验一下”,根据周围体验者的报告来看,还不怎么稳定。不过fedora对我来说已经是久违了的东西,我想我已经不可能再回去使用它了,许多地方设计的太不人性化,习惯了apt和sudo的我再用su和yum可能都永不惯了,而且我感觉fedora对硬件识别的功能比ubuntu要差些,ubuntu其实在大多数情况下都能默认安装识别硬件,特别是比较新的硬件,fedora的硬件兼容性相对就差些了。

 

最后来个桌面截图吧,开了透明窗口功能了(这个功能完全不卡诶,开了和没开几乎没有任何区别),常用软件在最下面隐藏了


 
2011-03-09 18:46

大家点开来观赏吧……注意这是在浏览器里的效果不是蓝屏

 

 

 
2011-02-15 18:24

转载自OMG Ubuntu,我知道这网站国内被墙了所以贴出来方便点(其实是给你自己方便吧!)

 

#!/bin/bash
#
# FLASHCOPY
#
# Will ieterate through all open copies flashplayer and copy flash video to the
# current folder (or specified directory) with the .flv extension added.

args=("$@")

args=`echo $args | sed 's/[/]$//'`

pids=`eval pgrep -f flashplayer`
for pid in $pids
do
lsoutput=$(lsof -p $pid | grep '/tmp/Flash[^ ]*')

IFS=$'\n'
for line in $lsoutput; do
lsout1=`echo $line | awk '{print "/proc/" $2 "/fd/" $4}' | sed 's/[rwu]$//'`
lsout2=`echo $line | awk '{print $9}' | awk -F '/' '{print $3}'`

if [ -n "$args" ];then
if [ -d $args ]; then
echo "Copying $lsout2 to $args/"
eval "cp $lsout1 $args/$lsout2.flv"
else
echo "The directory \"$args\" doesn't exist"
break
fi
else
echo "Copying $lsout2"
eval "cp $lsout1 $lsout2.flv"
fi

done
done

 

 

 

稍微说下原理,运行中的进程其实都在/proc里,所以根据/proc加上pid下的文件夹就能找到当前正在产生的缓存文件。熟悉awk语言的不难懂。(不熟悉也没关系)

 

使用方法,在youtube窗口开着的时候,运行bash flashcopier.sh (内容就是上面那些),会保存到当前文件夹下,如果运行bash flashcopier.sh ~/Videos 则拷贝到~/Videos文件夹下,非常简单吧!

 
2010-11-15 18:31
发给大家一个ubuntu下pdf转成txt文本格式的命令,因为好多人看书的工具不只是电脑而已。

命令名称叫pdftotext,默认基本都装好了(package名称为poppler-utils如果没装的话),命令:pdftotext -eol unix -nopgbrk sample.pdf sample.txt

转换率基本100%成功,而且非常整齐,只要原文件不是非常乱的(纯文字最佳),基本效果非常好,零乱码。
 
2010-07-08 10:36
这个问题其实应该是个mysql和php链接的bug吧,一开始用load_file失效是因为mysql在my.cnf中设置的最大文件不够大,但是一般都没有修改my.cnf的权限。所以就想到了先用php把内容拿出来,然后通过mysql的update命令存进去,虽然加了slashes了,但是还是报segmentation fault,其实就是滥用内存导致出错了。解决方法就是(可能windows下根本没这个毛病?),先把文件名存好,然后在文件内容前面写上update xxx set content =',文件后面的内容写上' where xxxid=xxx,拼成一个完整句子后,再存到一个新的文件里,然后通过mysql的command line执行,也就是mysql tablename < filename,这样的话就绕过了mysql和php的组件,直接用mysql来调用,就不会有错了。其实还是挺复杂的,我写了个通用的bash程序,php只要扔进去文件名、暂存文件名、以及更新的id,然后exec一下,剩下的让bash执行就得了,把bash和php的部分内容贴在这里,以备以后用:

php:
$tmpfileName = uniqid();
@exec('bash /home/ada/bin/inkdocs/allparagraph4php '.$txtFolder.$fileName.'.txt'.' '.$tmpfileName.' '.$item['id']);

bash:
#!/sbin/bash
FILENAME=$1
TMPFILENAME=$2
SOURCEID=$3

echo '' > '/tmp/'$TMPFILENAME
BIGTXT="$(cat $1 | sed 's/['"'"'"]/\\&/g')"
MYSQL_TEXT=" UPDATE IGNORE product_bak SET content = '$BIGTXT' WHERE sourceid = $SOURCEID; "
WC="$(echo $BIGTXT | wc -w)"
if [ $WC -lt 100000 ]
then
echo $MYSQL_TEXT > '/tmp/'$TMPFILENAME
mysql -h192.168.1.147 -uada -pada inkdocs < '/tmp/'$TMPFILENAME
rm '/tmp/'$TMPFILENAME
echo 'done'
fi

注明:sed那些是为了给双引号单引号加slash,相当于php中的addslashes
 
2009-12-17 15:09

想到用python写,主要是自己不会写python(这什么话),所以也一直对python比较好奇。另外,python在linux下可以直接用命令行输入,不需要任何安装……一句话简洁的命令就能完成,方便至极。而如果用自己比较熟悉的php写的话,还要打开浏览器,输入很长的url……况且打开个命令行比打开新网页输入速度快多了。。好吧,其实关键还是我比较好奇吧,废话少说。

功能:不登录lastfm的userpage,就能直接看最近7天的播放列表(其实现成的已经有了吧- -)

众所周知,每次进lastfm,要一个一个用户点,然后去看他的7天播放,那是很麻烦的,而且有的用户还是收费会员,这么一点他就发现了,还要过来打招呼。lastfm对7天播放提供了个简单但很囧的xml,也没有rss,也没有json,于是firefox的默认rss阅读器根本读不了,也不明白为啥 recently played就可以有rss,7天就不能有。再说我也不想bookmark他们,就是想看看- -

于是,就边看文档边写了。也算能用吧- -我就当做开源,虽然这程序被高手看一定特丢脸,但是至少能用吧,也给那些和我一样条件,并使用lastfm的人。

执行:如果没有执行权限的话,就: python lastfmlist.py '用户名',否则:./lastfmlist.py '用户名'
结果:就是出现这个人的artst,play count,以及这个artist的url


from xml.etree.ElementTree import parse
import urllib2
import xml.parsers.expat
import sys
import re

class PlayHistory():

def __init__(self):
self.userName = sys.argv[1]
self.urlBase = 'http://ws.audioscrobbler.com/2.0/user/' + self.userName
self.displayDics = {'name': 'A: ', 'url': '\t | ', 'playcount': '\t | PC: '}
self.currentName = ''

def search(self):
url = self.urlBase + '/weeklyartistchart.xml'
opener = urllib2.build_opener()
file = opener.open(url)
tree = file.read()
self.p = xml.parsers.expat.ParserCreate()
self.p.CharacterDataHandler = self.handleCharData
self.p.StartElementHandler = self.handleStartElement
self.p.EndElementHandler = self.handleEndElement
self.p.Parse(tree, 1)

def handleCharData(self, data):
if self.currentName in self.displayDics and re.match('\w', data):
print self.displayDics[self.currentName] + data ,
def handleStartElement(self, name, attrs):
self.currentName = name
def handleEndElement(self, name):
if name == 'artist':
print '\n'

if __name__ == '__main__':
c = PlayHistory()
c.search();


百度会自己缩进,也不提供给我个让我缩进的功能,我实在是TM无语鸟……
 
2009-10-13 21:53
今天我做了个重大决定。在ubuntu下安装虚拟机,并在其中安装windows xp。为的是什么呢,就是微软那可恶的MSN在ubuntu下传送文件实在是太慢了。pidgin的msn-pecan虽强大到可以支持正在播放、签名、头像。以及偷窥对方是否加了你,对方是否准备和你说话又哑然而止。。。但是他不能支持P2P的传输啊!!这速度慢的,每每都眼睁睁地看着它吃力地从2k-5k爬啊爬。。我终于按下了取消键!打入了一下命令:

sudo apt-get install virtualbox

安装虚拟机!I am the one made dicision! 选择virtualbox是因为他是sun开发的。我对这个公司比较有好感,另外这个安装文件出奇的小,总共加起来(包括ose)才18M左右。快快安装完了以后。便能用了。

接下来的路径和命令我只能凭记忆,但是多半是不会错的。最多有些拼写上的错误,不影响引导性。

首先是打开accessory(安装说明里说在system tools里。)里这个软件,我这边好像叫virtualbox ose。
然后点“new”创建一个新的虚拟机,取名叫winxp。在下面两个下拉菜单里的ostype选上microsoft windows xp。我这边默认全选好了。对于ubuntu玩家应该这个不难吧。







然后是分配内存,我因为就拿来装个msn(奢侈啊。。为了装个msn居然装系统。。)。所以就分配了256MB.
然后就是分配硬盘空间了,按new就会创建新的,然后next,一般选第一个也就是动态分配空间(一个dynamic开头的单词),这样比较省吧。再next就是镜像的大小,我选了10G我看装个系统绰绰有余。
然后点完成就回到原来的地方了,选好分配好的硬盘空间后继续。

全部搞定后,windows xp就在准备状态了。这个时候别急着按start,先按settings,进入以后,加载你现有的xp光盘,我用的是iso文件。因为发现公司里的windows xp iso文件多的离谱。。。随便对比了下发现了一个最小的,但是也有近600M。然后在settings里选择mount cd/dvd drive。然后选择ISO Image File。选好后还是表急着按确定。
再到shared folders地方,选好ubuntu下的共享文件夹。我还勾选了"permanent“虽然我也不知道干啥用……
全部选好以后,然后再按start。这时候就会开始自动安装你iso下的windowsxp了。

安装过程异常顺利,只是驱动有点不完全。使用dell自带的驱动安装时提示出错,说不能满足最低配置之类的。于是网上查了下,还必须得在virtualbox的菜单devices中,选"install guest additions",这个是专门用来安装驱动的。进入以后,如果没有这个guest additions的iso,他会自动下载并复制到指定的文件夹下,当然你也可以复制黏贴路径后自行下载,比如像我这样的需要限制网速的,就只能自行下载好并放到/usr/share/virtualbox下面。如果还是提示找不到就按照他所提示的文件名重命名一下,文件名应为:VBoxGuestAdditions.iso,多半没有什么问题。



安装好后,你会看到windows xp的光驱里面已经加载了这个iso文件。然后安装第一个guest additions(如果你是64位就安装第二个)。然后重新启动,基本光驱就全安装完了。

如果遇到RP不好的,声卡还是识别不了的,请参照这篇:
http://pcxapple.spaces.live.com/blog/cns!1C9542A2DEA3223F!229.entry

然后就是如何在xp里看到设置好的ubuntu文件夹共享了,比如你设置的路径为/home/jacinto/Videos,那么默认这个sharename就叫做Videos,然后在windows xp的命令输入框(运行-cmd...)中输入:
net use x: \\vboxsvr\Videos
这个x便是你喜欢的盘符名称,只要不冲突了就好。回车以后,如果出现成功提示,就表示完成了。如果没有说明共享文件夹名称可能有问题或者压根没有设置共享文件夹。如果没有设置的话还有补救机会,就是virtualbox这个加载windows窗口的右下角有一个文件夹图标,点击(或双击。。)以后,还是能设置的。然后再输入上面这段代码就应该大功告成了。



查看这个文件夹就更简单了,直接进入我的电脑就能看到。

装完后安装该装的msn和淘宝旺旺就没事了。linux下淘宝东西是能买的,到alipay的官方博客就能找到下载和操作方式:
http://blog.alipay.com/301.html
 
2009-06-26 18:09
sip_sign获取的问题:
sip_sign其实是由所有的post参数根据参数名顺序后MD5加密出来的。
如果params是这样的:

首先得session_start一下。

$context = array();
$context['sip_timestamp'] = date("Y-m-d H:i:s");
$context['appId'] = '你的appId';
$context['userId'] = '您的userId';
$context['appInstanceId'] = '你的appInstanceId';
$context['sip_sessionid'] = session_id();//在ISV应用中用户会话唯一标识
$context['sip_appkey'] = "你的appkey";//软件互联平台分配给ISV应用的唯一编号
$context['v'] = '1.0';
$sip_appsecret = "一般都是固定的";//当前应用的安全编码

appId、userId,appInstanceId这些都是固定的,到http://isv.alisoft.com/isv/portal/api/apitest!showapi.jspa 登录一次,选择XML,阿里软件,用户类接口,alisoft.validateUser,REST,POST,接下来的sip_appkey就是这里的appId,userId, appInstanceId,sip_appsecret也都有了。

接下来就是你针对不同API的不同参数。
然后来一下:
ksort($context);
这样就按照参数顺序了。

接着合并加密前的sip_sign:
$signStr = $sip_appsecret;
foreach ($context as $key => $value) {
    $signStr .= $key.$value;
}
$context['sip_sign'] = strtoupper(md5($signStr));

之后就是使用POST的HTTP CLIENT把这些数据都发出去。我是用Zend_Http_Client发的,很推荐用,非常安全,再说官方的嘛。

$formVars = $context;
$http = new Zend_Http_Client();
$http->setUri('http://sip.alisoft.com/sip/rest');
foreach ($formVars as $key => $value) {
    $http->setParameterPost($key, $value);
}
$response = $http->request("POST");
$body = $response->getBody();
$headers = $response->getHeaders();
Header('Content-type: text/xml;charset=UTF-8');
echo $body;

token问题我研究了半天也没研究出来,但是这样的话,如果没有授权,返回的xml(其实我推荐json)会有一个url和一个errorcode:1004,error的msg是needBinduser,这时只要拿这个url,跳转一下,然后选择一个时间(一小时),提交后就授权了。在这1小时之内就再也不用跳转了,用任何需要登录的API都不用再登录。


新增商品/更新商品的问题:
进这个文档中,找商品API,taobao.item.add
http://isp.alisoft.com/apidoc/api/apiIndex.html#isp_taobao-5-30
这些字符串是都需要填的,特别是props,当用户选择到了某个属性must的分类,就表示这个选项也是必选的。这里有一个非常讨厌的问题耗费了我大半天,也就是当一个属性必须是自定义属性,由卖家输入的话,就不知道怎么填了。其实这里漏了两个:input_str, input_pids
input_str一般都是这样的:
比如:
精油->唇部护理->其它化妆品品牌->唇部护理单品->alba
这个alba就是你的自定义属性,所以input_str就是:
其它化妆品品牌;唇部护理单品;alba

input_pids就是唇部护理的ID,也就是
20000

多个input_str和input_pids都用逗号分割。如果是比较简单的:
食品->其他->某个商品名
那你的input_str就简单了:
某个商品名
也就是从第三层开始写
input_pids从第二层开始,这里是20000。

然后用zend http client提交,立刻就新增了该商品咯。
 
2009-06-02 21:42
elodia告诉俺的……
叫gladder,有空用吧。打不开时,点一下“换一个代理“,就好了。
 
2009-06-01 22:12


happy tree friends哈哈哈哈哈哈哈
 
2009-05-27 16:22
http://bighugelabs.com!!貌似有很多功能,可以让你的flickr里的照片有许多种特殊效果,而且不是photoshop那样的哦!更不需要任何图像处理的经验,一切一个按钮搞定!
我玩了一个bead art的,效果还不错:

 
2009-05-20 16:56
http://www.ultimate-guitar.com/news/general_music_news/student_shoots_himself_after_teacher_demanded_to_praise_marilyn_manson.html

故事原委是这样的:
那个同学要老师表扬MM,老师不愿意,那人试图杀死老师,结果没成功,就自杀了,但也没成功。。
鉴于这页面已经被删除了……我来保留一下现场,其实这标题错了,应该是student shoots himself after teacher was demanded to praise marilyn manson,但是一般标题都会把was去掉于是意思就彻底变,成了老师要求他的学生表扬manson,学生不愿意并自杀了。

贴点经典回复:
Blash56 :
Basically he shot twice at someone, didnt even hit them, then shot himself in the face, and still survived. He also listened to Marilyn Manson. Could he be anymore of a failure?

liquidknowledg4 :
Wow what a stupid kid. He didnt even die hahah. Now he has to live with not being able to handle making it through his "rough" teenage years. Actually, maybe he won't even know anymore because hes probably a vegetable.

RedNovember :
Maybe, just maybe, it IS his fault. Think about it...Whenever something like this happens, Manson ALWAYS ALWAYS ALWAYS comes up. Is there something in those lyrics we aren't seeing?

Lil' Pookie :
Marilyn Manson is responsible for this. Listening to his music made this sweet innocent child want to kill people, Just like Listening to Coldplay makes me want to suck a dick.

I'm only kidding, all you Coldplay fans can stop lisping such hateful things at me.
 
2009-05-04 13:17
下载是从ed2k上下的DVD版本,用搜索就能搜索到了。因为我已经删除了所以不能找到ed2k地址了- -,下载的人很多,所以速度很快。一共4G多,做成DVD,这样安装起来就可以快很多。

我是从ubuntu 8.10升级过来的。升级时间一共大概60分钟。在安装的时候出现了python 2.6可疑版本的提示,但安装过后没有什么问题。其他均没有任何问题,安装时候smooth的不得了。我甚至还在用firefox上网。。
安装完后的界面我就不贴了,在这里可以看到:
http://www.howtoforge.com/the-perfect-desktop-ubuntu-9.04

标准界面:


总体来说,感觉和8.10没有多大差别。启动时间短了。login的窗口变了……

多了一个indicator-applet 0.1,于是pidgin有人登录、rhythmbox播放音乐,发消息都会像windows下的msn出现提示界面,样子也比较好看:



另外是声音的volumn control比以前nb点了,有点像windows下的。但是咋没有pulse audio呢,那个更强大些。而且已经预装了,想了想可能是方便于比较初级的人使用吧- -

gvim升级为7.2了,这个版本修补了很多bug。但是我以前就迫不及待的装上了……


用到现在有一个bug:就是trackerd,这个bug貌似所有的9.04的人都碰到了,解决的方法是安装tracker-utils后,使用tracker-processes -r把它杀掉,但这应该治标不治本吧。。。反正先凑合着用了。

界面方面也没感觉快多少。。但是多了两个theme,dust和new wave。但我还是用我自己的。
给大家看下新的几个theme:

有一个地方的界面特别丑,我也截图给大家看看:
也就是选择的部分会有一个圆的空袭,上面也有很粗很粗的一个border,我起初还以为是自己的gtkrc没写好。结果发现所有的都是一样,可能是gnome的一大新特色- -目前为止还不知道怎么改。也懒得在上面费时间了。

还发现个很无用的新产品,Computer Janitor:

里面许多都是有用但没有通过apt-get来安装的软件,他居然让我全部清空,如果谁点了那就等着机器无法启动吧。。。而且还没有全选和全反选的按钮,一个一个打勾太累了。更昏的是,你点完cleanup后,他还会弹出提示问你:are you sure?好像是知道自己的软件要导致系统报废,所以特地挑衅你似的……
 
2009-04-16 17:04
今天奋力终于做出自己想要的metacity了。其实我要求很低,就是想要个极简的metacity而已……终于看到了这个漂亮的metacity:
http://cisoun.deviantart.com/art/MGT-Suite-Metacity-Pack-0-2-94729206



看着很漂亮是吧。。。。其实华而不实的地方就是,titlebar的metacity也太长太长了。占了好大地方。而且这个metacity的图片也多,图片多应该加载会比较慢。所以就改了:

现在的截图:
贴出来共享一下。图片都在da的链接里。


<?xml version="1.0"?>
<metacity_theme>
<info>
    <name>MGT Suite Metacity Theme</name>
    <author>Cyriaque 'Cisoun' Skrapits</author>
    <copyright>(c) 2008 Cyriaque 'Cisoun' Skrapits</copyright>
    <date>13rd August 2008</date>
    <description>
        The MGT Suite Metacity theme.
        Version 0.1
    </description>
</info>

<constant name="IconTitleSpacing" value="0"/>

<frame_geometry name="normal" rounded_top_left="false" rounded_top_right="false" rounded_bottom_left="false" rounded_bottom_right="false" title_scale="medium">
   <distance name="left_width" value="1"/>
   <distance name="right_width" value="1"/>
   <distance name="bottom_height" value="1"/>
   <distance name="left_titlebar_edge" value="5"/>
   <distance name="right_titlebar_edge" value="5"/>
   <distance name="button_width" value="12"/>
   <distance name="button_height" value="12"/>
   <distance name="title_vertical_pad" value="12"/>
   <border name="title_border" left="1" right="1" top="1" bottom="1"/>
   <border name="button_border" left="0" right="0" top="0" bottom="2"/>
</frame_geometry>

<frame_geometry name="border" parent="normal" has_title="false">
<distance name="button_width" value="12"/>
<distance name="button_height" value="12"/>
<border name="title_border" left="1" right="1" top="1" bottom="1"/>
<border name="button_border" left="0" right="0" top="2" bottom="2"/>
</frame_geometry>

<draw_ops name="title-text-focused">
<title color="#ffffff" x="(width - title_width) / 2" y="5"/>
</draw_ops>

<draw_ops name="title-text-unfocused">
<title color="#E8E8E8" x="(width - title_width) / 2" y="5"/>
</draw_ops>

<draw_ops name="blank">
</draw_ops>

<draw_ops name="title">
<line color="#969696" x1="0" y1="0" x2="width" y2="0" />
<rectangle color="#333333" x="0" y="1" width="width" height="24" filled="true"/>
<rectangle color="#b12619" x="0" y="25" width="width" height="7" filled="true"/>
</draw_ops>

<draw_ops name="title-unfocused">
<line color="#969696" x1="0" y1="0" x2="width" y2="0" />
<rectangle color="#333333" x="0" y="1" width="width" height="24" filled="true"/>
<rectangle color="#EBD700" x="0" y="25" width="width" height="7" filled="true"/>
</draw_ops>

<draw_ops name="frame-left-focused">
<image filename="o.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="frame-right-focused">
<image filename="o.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="frame-bottom-focused">
<image filename="o.png" x="0" y="0" width="1" height="1"/>
<image filename="o.png" x="1" y="0" width="width - 1" height="1"/>
<image filename="o.png" x="width - 2" y="0" width="1" height="1"/>
</draw_ops>

<draw_ops name="button-close-focused">
<image filename="button-close-focused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-close-unfocused">
<image filename="button-close-unfocused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-close-pressed">
<image filename="button-close-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-insensitive">
<image filename="button-insensitive.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-maximize-focused">
<image filename="button-maximize-focused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-maximize-unfocused">
<image filename="button-maximize-unfocused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-maximize-pressed">
<image filename="button-maximize-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-minimize-focused">
<image filename="button-minimize-focused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-minimize-unfocused">
<image filename="button-minimize-unfocused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-minimize-pressed">
<image filename="button-minimize-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-menu-focused">
<image filename="button-insensitive.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-menu-unfocused">
<image filename="button-insensitive.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="button-menu-pressed">
<image filename="button-insensitive.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<frame_style name="normal-focused" geometry="normal">
<piece position="titlebar" draw_ops="title"/>
<piece position="left_edge" draw_ops="frame-left-focused"/>
<piece position="right_edge" draw_ops="frame-right-focused"/>
<piece position="bottom_edge" draw_ops="frame-bottom-focused"/>
<piece position="title" draw_ops="title-text-focused"/>
<button function="close" state="normal" draw_ops="button-close-unfocused"/>
<button function="close" state="prelight" draw_ops="button-close-focused"/>
<button function="close" state="pressed" draw_ops="button-close-pressed"/>

<button function="minimize" state="normal" draw_ops="button-minimize-unfocused"/>
<button function="minimize" state="prelight" draw_ops="button-minimize-focused"/>
<button function="minimize" state="pressed" draw_ops="button-minimize-pressed"/>

<button function="maximize" state="normal" draw_ops="button-maximize-unfocused"/>
<button function="maximize" state="prelight" draw_ops="button-maximize-focused"/>
<button function="maximize" state="pressed" draw_ops="button-maximize-pressed"/>

<button function="menu" state="normal" draw_ops="button-menu-unfocused"/>
<button function="menu" state="prelight" draw_ops="button-menu-focused"/>
<button function="menu" state="pressed" draw_ops="button-menu-pressed"/>
</frame_style>

<frame_style name="normal-unfocused" geometry="normal">
<piece position="titlebar" draw_ops="title-unfocused"/>
<piece position="left_edge" draw_ops="frame-left-focused"/>
<piece position="right_edge" draw_ops="frame-right-focused"/>
<piece position="bottom_edge" draw_ops="frame-bottom-focused"/>
<piece position="title" draw_ops="title-text-unfocused"/>

<button function="close" state="normal" draw_ops="button-insensitive"/>
<button function="close" state="prelight" draw_ops="button-close-focused"/>
<button function="close" state="pressed" draw_ops="button-close-pressed"/>

<button function="minimize" state="normal" draw_ops="button-insensitive"/>
<button function="minimize" state="prelight" draw_ops="button-minimize-focused"/>
<button function="minimize" state="pressed" draw_ops="button-minimize-pressed"/>

<button function="maximize" state="normal" draw_ops="button-insensitive"/>
<button function="maximize" state="prelight" draw_ops="button-maximize-focused"/>
<button function="maximize" state="pressed" draw_ops="button-maximize-pressed"/>

<button function="menu" state="normal" draw_ops="button-menu-unfocused"/>
<button function="menu" state="prelight" draw_ops="button-menu-focused"/>
<button function="menu" state="pressed" draw_ops="button-menu-pressed"/>
</frame_style>

<frame_style name="normal-shaded-focused" geometry="normal" parent="normal-focused">
<piece position="titlebar" draw_ops="title"/>
</frame_style>

<frame_style name="normal-shaded-unfocused" geometry="normal" parent="normal-unfocused">
<piece position="titlebar" draw_ops="title-unfocused"/>
</frame_style>

<frame_style_set name="normal">
<frame focus="yes" state="normal" resize="both" style="normal-focused"/>
<frame focus="no" state="normal" resize="both" style="normal-unfocused"/>
<frame focus="yes" state="maximized" style="normal-focused"/>
<frame focus="no" state="maximized" style="normal-unfocused"/>
<frame focus="yes" state="shaded" style="normal-shaded-focused"/>
<frame focus="no" state="shaded" style="normal-shaded-unfocused"/>
<frame focus="yes" state="maximized_and_shaded" style="normal-shaded-focused"/>
<frame focus="no" state="maximized_and_shaded" style="normal-shaded-unfocused"/>
</frame_style_set>

<window type="normal" style_set="normal"/>
<window type="dialog" style_set="normal"/>
<window type="modal_dialog" style_set="normal"/>
<window type="menu" style_set="normal"/>
<window type="utility" style_set="normal"/>
<window type="border" style_set="normal"/>

<menu_icon function="close" state="normal" draw_ops="button-close-focused"/>
<menu_icon function="maximize" state="normal" draw_ops="button-maximize-focused"/>
<menu_icon function="unmaximize" state="normal" draw_ops="button-maximize-focused"/>
<menu_icon function="minimize" state="normal" draw_ops="button-minimize-focused"/>

</metacity_theme>
 
   
 
 
文章分类
 
   
 
文章存档
 
     
 
最新文章评论
  

很有用处。
 

这贴实在太老了。。不好意思,完全不记得我自己在说啥……
 

hahahahahahahahahhahhahahha
 

那个action是怎么的?怎么通过action改变那些阿?不懂..我想问的是, 它是如何弄成动画
 

您又给力了
   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu