Published at 18 Dec, 2007
·
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WaceManager.Classes
{
public class IniProcess
{
private string path;
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(
string section, string key, string value, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(
string section, string key, string def,
StringBuilder retVal, int size, string filePath);
public IniProcess (string iniPath)
{
this.path = iniPath;
}
public void write(string section, string key, string value)
{
WritePrivateProfileString(section, key, value, this.path);
}
public string read(string section, string key, string defaultValue)
{
StringBuilder temp = new StringBuilder(255);
GetPrivateProfileString(section, key, "", temp, 1024, this.path);
return (temp.Length > 0) ? temp.ToString() : defaultValue;
}
}
}
/* vim: set expandtab tabstop=4 shiftwidth=4: */
Published at 19 Nov, 2007
·
Published at 16 Nov, 2007
·
-
SVN中文论坛 翻译整理: PCplayer
关键词:subversion 安装 服务器 配置 apache ssl
最后更新:2007-8-19
版本:v1.0
修改历史:
v0.1 2006-08-06
v0.2 2006-09-10 加入ssl的配置
v0 … - Discuz! Board
-
-
-
-
Published at 6 Nov, 2007
·
Published at 7 Aug, 2007
·
在 PHPChina 的论坛看到有人问,如何使用 PHP 得到一个媒体的文件的播放时间,然后就自己尝试用 COM 写了一段代码,开始以为蛮复杂的,不过还好思路对了,只是在浩瀚的 MSDN 上查找 WMP SDK 的资料折腾的够呛,最后写出的代码却只有寥寥几行,o(∩_∩)o…代码如下:
<?php
// mp3, wav or any other file formats that media player supports.
$file = "C:/I Wanna Go To A Place.mp3";
if (!file_exists($file)) {
exit('Media file does not exist.');
}
// Create an instance of Windows Media Player
$player = new COM("WMPlayer.OCX");
$media = $player->newMedia($file);
// Get the duration of a media file (seconds)
print $media->duration;
在 PHP Manual 的 XV. COM and .Net (Windows) 一章,还看到一位叫 Pedro 的同学提交的利用 WMP OCX 弹出光驱的 PHP 代码。
有兴趣的朋友可以玩玩:
<?php
// Create an instance of Windows Media Player
$mp = new COM("WMPlayer.OCX");
// Ejects the first cd-rom on the drive list
$mp->cdromcollection->item(0)->eject();
Published at 2 Aug, 2007
·

“Hacking Vim: A Cookbook to get the Most out of the Latest Vim Editor”,这是一本最新的关于 Vim 的书籍,作者是 Kim Schulz.
该本是在 Vim7 发布以后开始写的,因此囊括了所有 Vim 新功能,比如语法检查,omni-completion等等,如果想了解 Vim 的新功能,没有比这本书更好的了。
该书主要针对那些对 Vim 有一定了解的用户。
这里有一份 PDF 格式的免费章节。
如果想了解详细信息,或者想购买,可以看看这里:
http://iccf-holland.org/click5.html#hacking
另:已经找到完整的电子书了!
http://phpvim.net/files/Packt.Publishing.Hacking.Vim.May.2007.pdf.7z
Published at 31 Jul, 2007
·

这次直接升级到 1.00 stable,终结该死的 beta version。
感谢 72pines 提供的 mo/po 翻译文件,Fanfou Tools 现在有了中文版本。
如果您在使用的过程中,仍然显示为英文界面,打开 wp-config.php 文件,修改如下代码:
// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-includes/languages.
// For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
// to enable German language support.
define ('WPLANG', 'zh_CN');
fanfou tools 已经加入官方的 Plugins 列表:
http://wordpress.org/extend/plugins/fanfou-tools/
如果您有 SVN 客户端软件,也可以从 SVN 上下载最新的代码:
svn co http://svn.wp-plugins.org/fanfou-tools/trunk
详细信息、下载,请访问:
WordPress Plugin - Fanfou Tools
Published at 22 Jul, 2007
·
PHP6 的 snapshot 版本中,namespace 功能已经实现了,下面我们就通过几个简单的示例来介绍一下,如何在 PHP6 中使用 namespace。
一、如何定义 namespace?
// net/phpvim/code/Shape.php
namespace net::phpvim::code;
class Shape{
}
function draw() {
return "draw() in Shape.php\n";
}
function getCurrentNS() {
return __NAMESPACE__;
}
/* vim: set expandtab tabstop=4 shiftwidth=4: */
所有的类和函数名称会自动加上 namespace 名称作为前缀,相同的 namespace 也可以在多个 PHP 文件中被定义。
比如上面的代码中,完整的类名和函数名是:
net::phpvim::code::Shape
net::phpvim::code::draw()
二、如何使用呢?
// net/phpvim.net/code/Painter.php
require_once 'net/phpvim/code/Shape.php';
import net::phpvim::code;
import net::phpvim::code::Shape;
import net::phpvim::code::Shape as CPC_Shape;
// Create an instance object for Shape class
$shape0 = new net::phpvim::code::Shape();
$shape1 = new code::Shape();
$shape2 = new Shape();
$shape3 = new CPC_Shape();
// output: draw() in Shape.php
print net::phpvim::code::draw();
print code::draw();
// output: net::phpvim::code
print code::getCurrentNS();
/* vim: set expandtab tabstop=4 shiftwidth=4: */
import 指令
import 可以将任意的 package(这里借用一下 Java 的概念)导入到当前 scope 中来。
import 不可以使用在函数或者类中。
import 生效范围为当前定义位置到所在文件的结尾。
import 可以通过 AS 关键字定义别名。
import A::B; 等同于 import A::B as B。
三、其它
特殊的 empty namespace ::
import net::phpvim::code;
echo ::draw();
/* vim: set expandtab tabstop=4 shiftwidth=4: */
:: 是一个特殊的 namespace,以 :: 开头的调用,将会在 global 范围查找并绑定相应的 Class 或者 Function。换句话说,定义在任意 namespace 中的 draw() 函数都不会被调用,而是调用 global 范围内的 draw() 函数。
constant __NAMESPACE__
__NAMESPACE__ 表示当前的 namespace 的名称。
Published at 21 Jul, 2007
·
-
看看月光怎么说来着…
-
办证… 我啥证都没有 ;|
-
在我的电脑中追加快捷方式…