木鱼与代码
muyu · 共 88 篇文章
取消 Google 搜索结果链接重定向,外加新页面打开
chinaz有篇文章《取消 Google 搜索结果链接重定向》,在火狐下装好后,是不用经过google再跳转到目标网页了。不太满意的是,目标网页是在当前搜索结果页打开的,不符合自己的习惯。 将xpi改为zip,解压,修改 remove_google_search_redirect-0.5-fx\resources\google-no-tracking-url\data\google.js: var resultLinks = document.querySelectorAll("#search ol li a"); var forEach = Array.prototype.forEach;…
2012-11-30 10:38 · javascript · 评论(0)
安装PHP memcached扩展
兜了一圈,记下来。感谢 《 memcached安装 和php模块的安装 》 注意:该php扩展需要libmemcached,而libmemcached的版本很重要,高的几个版本都不行,倒是libmemcached-1.0.2完胜。 老步骤: 1.安装memcached,这是软件,将来存储数据的地方。 2.安装libmemcached,它是扩展需要的东东: ./configure --prefix=/usr/local/libmemcached 3.安装php memcached扩展: ./configure --with-libmemcached-dir=/usr/local/libmemc…
2012-10-26 11:01 · php · 评论(0)
【转载】用谷歌浏览器来当手机模拟器
摘自 http://blog.s135.com/chrome_phone/ 谷歌Android: chrome.exe --user-agent="Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" 苹果iPhone 4: chrome.exe --user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac O…
2012-08-17 21:23 · 评论(0)
mysql 授予IP访问某个数据库
GRANT ALL PRIVILEGES ON *.* TO 'db'@'34.34.34.34'IDENTIFIED BY 'dbpasword' WITH GRANT OPTION;
2012-06-30 18:21 · mysql · 评论(0)
PHP锐化图片
简单验证码的识别步骤有:黑白、锐化、切分、建模。 说说如何锐化,我从网上找到一个C#版本的: //hsb: 0与1之间的值 public static Bitmap BitmapTo1Bpp(Bitmap img,Double hsb) { int w = img.Width; int h = img.Height; Bitmap bmp = new Bitmap(w, h, PixelFormat.Format1bppIndexed); BitmapData data = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadW…
(转)如何监控脚本运行状态
原文地址: http://stackoverflow.com/questions/45953/php-execute-a-background-process#45966 Assuming this is running on a Linux machine, I've always handled it like this: exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile)); This launches the command $cmd, redirects the command outp…
2012-01-01 11:47 · php · 评论(0)
ssh-keygen 免密码登录
每次买VPS,初始化同样的操作系统,在安装LNMP环境时,却不能保证一次通过!不少同学搞了一键安装包,可能我人品不高,每次编译都不顺利。在与系统工程师沟通之后,我决定放弃一键安装的思路。 电影《阿甘正传》有句关于巧克力的台词,与此相同。 记录一下,ssh-keygen凭证书登录的方法,供以后查询: 步驟如下: ssh-keygen -t rsa 或 ssh-keygen -d (dsa) => 產生出 id_rsa, id_rsa.pub scp id_rsa.pub server_hostname:~/.ssh/ ssh server_hostname cat .ssh/id_rsa.pu…
2011-12-27 14:33 · linux · 评论(0)
HTML语义
我一直在喊“语义”,非常反感table+css,更反对div+css。最为推崇的是google网站管理员帮助文档,今天在淘宝Alice看到推荐的html语义小文,《 这样去写你的 HTML 》,有空常来看看~
2011-12-27 09:16 · 评论(0)
mdb2sqlite
微软access数据库貌似没有导出通用sql文件的功能,我也只能从mdb转换到sqlite想办法了。google到一篇文章,《 How to convert MDB files to SQLite 》说是在linux按照mdbtools,辅以shell,就可以搞定了。在编译之前,我的vps安装失败,根据提醒,得先安装“ unixODBC ”。 经过折腾,成功转换成sqlite数据库。
2011-12-22 15:56 · linux · 评论(0)
CURLOPT_GET报错
使用curl抓取网页或图片很多次了,今天在php的“E_ALL | E_STRICT”模式下,shell下会有报错: google搜索“+Notice: Use of undefined constant CURLOPT_GET - assumed 'CURLOPT_GET' in”,找到一篇文章《 PHP CURLOPT_GET Does not Exist! 》,原来,CURLOPT_GET本就不存在。 curl_setopt($ch, CURLOPT_GET, true); 注释掉改行即可。
2011-09-11 10:41 · php · 评论(0)
来自google的seo建议摘录
1.建议您在网址中使用标点符号。 网址 http://www.example.com/green-dress.html 比网址 http://www.example.com/greendress.html 对我们帮助大得多。 我们建议您在网址中使用连字符 (-) 而尽量避免使用下划线 (_)。 参考地址: http://www.google.com/support/webmasters/bin/answer.py?hl=zh-Hans&answer=76329 2.除"verify"(验证)外,在元标记中,大小写通常无关紧要。 参考网址: http://www.google.com/supp…
2011-09-04 13:43 · html · 评论(0)
windows 版本的memcache
在本地windows下开发,集成环境中用到了memcache,导致代码无法正常运行,因此不得不写额外的“开关memcache”的逻辑。 先收藏: http://splinedancer.com/memcached-win32/ The win32 version of memcached can be run both as a NT Service or from the command line. To install memcached as a service, follow the next steps: Unzip the binaries in your desired dir…
启用右键功能的chrome插件
经常碰到一些屏蔽右键功能的网页,无法查看网页源代码、点出右键菜单。我简单写了个chrome插件,代码不多: var targetEvents = ['oncontextmenu', 'onmousedown', 'ondragstart', 'onselectstart', 'onselect', 'oncopy', 'onbeforecopy', 'onbeforecopy', 'onmouseup']; $.each(targetEvents, function(index, value) { $('body').removeAttr(value); document[value] = …
2011-08-14 08:26 · javascript · 评论(0)
windows下PHP安装imagick扩展
别的不多说,网上有很多文章。只是运行不成功的也有很多,备注两点: 一个是win7下,下载完php_imagick.dll,拷贝到ext目录下时,注意右键点击属性,安全下的“解除锁定”要点击一下。 另一个是版本问题,按照 http://valokuva.org/?page_id=50&cpage=8#comment-22560 说的,“Apache, PHP and Imagemagick all have to be built with the same Visual Studio version on Windows”,因此我们必须去找一个用VC9编译的imagemagick,就是“ I…
2011-07-29 21:26 · php · 评论(1)