- 博客(14)
- 资源 (2)
- 收藏
- 关注
转载 8 个必备的PHP功能开发
1、传递任意数量的函数参数 我们在.NET或者JAVA编程中,一般函数参数个数都是固定的,但是PHP允许你使用任意个数的参数。下面这个示例向你展示了PHP函数的默认参数: // 两个默认参数的函数 function foo($arg1 = ”, $arg2 = ”) { echo “arg1: $arg1\n”; echo “arg2: $arg2\
2013-10-31 14:29:49 459
转载 php当中的memcache应用
所需环境:php 5.3.3apache 2.2.7mysql 5.5.8解压Memcached_1.2.5文档,cmd下执行memcached.exe -d -install将php5.3_vc6_memcachedll文档解压,将php_memcache.dll文件复制到php安装目录的ext文件目录中。然后在php.ini 当中填上这句话:ex
2013-02-25 11:27:58 251
转载 ruby 163 发送 邮件
require 'rubygems'require 'mail'smtp = { :address => 'smtp.163.com', :port => 25, :domain => '163.com', :user_name => '18703609654', :password => '****', :enable_starttls_auto => true, :openssl_ve
2013-01-23 10:39:40 509
转载 Ruby 使用 OpenGL 的例子
require "opengl"require "glut"$light_diffuse = [1.0, 0.7, 0.7, 1.0]$light_position = [1.0, 1.0, 1.0, 0.0]$n = [ [-1.0, 0.0, 0.0], [0.2, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.3
2013-01-23 10:38:10 421
原创 ruby编写的乘法口诀代码
TEST_FILE_NAME = '乘法口诀.txt'#创建文件File.open(TEST_FILE_NAME, 'w+') do |file| for x in 1..9 for y in 1..x if x==y file.print y,"×",x,"=",x*y,"\n" file.puts "" #加入空行,美观作用 e
2013-01-23 10:33:53 533
原创 Ruby 打开 Word 文档并打印
require "win32ole"docfile = "yourDoc.doc"word = WIN32OLE.new "Word.Application"word.visible = trueword.documents.open docfileword.options.printBackground = falseword.activeDocument.printOutw
2013-01-23 10:32:36 616
原创 在ruby使用ssh连接linux服务器
require 'net/ssh' host = hostipusername = usernamepassword = pwd##显示文件和系统版本server_cmd1 = 'ls -l'server_cmd2 = 'cat /etc/issue'# 连接到远程主机 foobarssh = Net::SSH.start(host, username, :passwor
2013-01-23 10:30:22 617
原创 Ruby 在 Windows 下读取键盘输入
require 'Win32API'def getch @getch ||= Win32API.new('crtdll', '_getch', [], 'L') @getch.callendwhile (c = getch) != ?\e puts "You typed #{c.chr.inspect}"end
2013-01-23 10:28:09 1034
原创 各种在线工具集
总的:http://www.ostools.net/各语言API:http://www.ostools.net/apidocs/JS在线调试工具:http://www.ostools.net/jsbin#javascript,html在线编码格式化工具:http://www.ostools.net/codeformat在线正则匹配工具:http://www.ostools.net/
2013-01-22 16:57:28 299
原创 ruby way之OOP之一
1.class ColoredRectangle def initialize(r, g, b, s1, s2) @r, @g, @b, @s1, @s2 = r, g, b, s1, s2 end def ColoredRectangle.white_rect(s1, s2) new(0xff, 0xff, 0xff, s1, s2) end def
2013-01-22 15:03:21 317
转载 Ruby多进程并行抓取网页
用Ruby写了一个脚本,用Beanstalk消息队列,把任务放入Beanstalk中,同时开启多个子进程,如20个,并行运行,同时抓取网页,先抓取完成的进程再次读取Beanstalk任务,继续执行,直到没有任务后,进程退出,主进程等待所有子进程退出后,打印抓取的消息。 Ruby的多线程实际是只能跑在单cpu上,并且同一时刻cpu只处理一个线程,所以采用多进程抓取,消息队列采用最简单的Beans
2013-01-22 14:55:12 577
原创 ruby+rails+mysql+win or linux的安装大全
首先下载 http://rubyforge.org/frs/download.php/75468/railsinstaller-2.0.1.exe此安装包含以下组件安装完成之后去;git是一个程序版本控制管理工具,需要到github.com上注册一个免费用户,注册步骤如下图。一、安装ruby-dbi下载地址:http://rubyforge.org/projects
2013-01-08 16:57:46 550
原创 php利用飞信api给好友发短信
class:<?php/** * PHP飞信发送类 * * @author quanhengzhuang * @version 1.5.0 */class PHPFetion{ /** * 发送者手机号 * @var string */ protected $_mobile; /** * 飞信密码 *
2012-12-25 11:50:24 528
转载 使用Python抓取网页信息
# -*- coding:gb2312 -*-import sysimport urllibimport re#从html中解析标题def ParshTitle(html): startPos = html.find('') endpos = html.find('') strTmp = html[startPos+29:endpos] strTmp = strTmp.re
2012-12-19 17:33:10 672
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人