How to use PackageThis

[不指定 2007/09/05 10:44 | by ipaddr ]

What's PackageThis

What It Does

Package This is a GUI tool written in C# for creating help files (.chm and .hxs) from the content obtained from the MSDN Library or the TechNet Library via the MSDN Content Service. You select the content you want from the table of contents, build a help file, and use the content offline. You are making personalized ebooks of MSDN or TechNet content. Both help file formats also give full text search and keyword search.

The code illustrates how to use the MSDN Content Service to retrieve documentation from MSDN or TechNet. It also shows how to build .hxs files and .chm files programmatically.

Prerequisites

Package This requires .NET 2.0, the .hxs SDK (MSHelp 2.0), part of the Visual Studio 2005 SDK, and the .chm SDK (You must Install HTML Help Workshop). If you just want to create .chm files, you don't need to download the .hxs components (and vice versa).

How to use

1. 安装.Net 2.0,如需生成CHM文件,需要安装MS HTML Help Workshop

2. 从官方网站 http://www.codeplex.com/packagethis 下载PackageThis

3. 下载后,解压,直接运行PackageThis。

4. 在菜单中选择Library (MSDN, TechNet),选择语言(通常英文的资料是最新最全的)

5. 使用左边的树形菜单,导航到你所需要下载的节点(整个Library很大,而且从中国到美国的访问速度很慢,如果选择比较上层的节点,可能需要很长的时间下载。)

6. 右击需要下载的节点,选择"Select this node and all children", PackageThis开始下载该节点和所有子节点的资料。请等待下载...

7. 下载完成后,点击菜单"File" => "Export to Chm File..." 或 "Export to Hxs File...",打包成CHM或HXS格式。

鱼漂(Ipaddr)提醒:Hxs格式需要专门的软件才可以打开,推荐使用Help Explorer 3.0

Reference

PackageThis: http://www.codeplex.com/packagethis

MSDN Library: http://msdn2.microsoft.com/library

TechNet Library: http://technet.microsoft.com/library

如何屏蔽sqlServer触发器

[不指定 2007/09/01 15:50 | by ipaddr ]

---

--禁用单个触发器:
ALTER TABLE trig_example DISABLE TRIGGER trig1
GO
--恢复单个触发器:
ALTER TABLE trig_example ENABLE TRIGGER trig1
GO

---

--禁用某个表上的所有触发器
ALTER TABLE 你的表 DISABLE TRIGGER all

--启用某个表上的所有触发器
ALTER TABLE 你的表 enable TRIGGER all

--禁用所有表上的所有触发器
exec sp_msforeachtable 'ALTER TABLE ? DISABLE TRIGGER all'

--启用所有表上的所有触发器
exec sp_msforeachtable 'ALTER TABLE ? enable TRIGGER all'

使用同样的方式,可以禁用和恢复约束:
exec sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT all'

exec sp_msforeachtable 'ALTER TABLE ? CHECK CONSTRAINT all'


测试了一天,终于可以工作了,配置大致如下:

Apache2.2+moj_jk1.2+tomcat5.5.9

C#(dotNet 2.0)中读写配置文件

[不指定 2007/08/18 17:21 | by ipaddr ]

C#(dotNet 2.0)中读写配置文件

dotNet已推荐使用新的方法读写配置文件,假设配置文件如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
  <add key="DBPath" value="data.mdb" />
 </appSettings>
</configuration>

首先,加入对System.configuration的引用(在资源管理器中,加入引用)

使用如下的方法读入配置:

using System.Configuration;

private Configuration config;
private AppSettingsSection appConfig;

config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
appConfig = config.AppSettings;
MessageBox.Show(appConfig.Settings["DBPath"].Value);

在Windows下安装CVSNT

[不指定 2007/08/17 10:09 | by ipaddr ]

在Windows下安装CVSNT

1 首先从www.cvsnt.org下载CVS服务器软件,文件名为cvsnt-2.5.01.1976.msi,CVSNT需要使用NTFS的文件格式,所以确保CVSNT和库安装在NTFS上,然后将CVSNT的主目录下的bin目录添见到系统的path路径中。

2 CVSNT的设置。打开CVSNT Control Panel,点击“Server Settings”,这里我们需要设置一下“Run as”和“Default”,分别是运行CVSNT程序的用户和计算机名称,这里可以设置系统的administrator即可。

3 接下来我们需要设置CVS库,只需在设置面板中选择“Repositories”,然后创建相关的库即可。然后我们就可以通过 :pserver:username@localhost:/reposname去引用这个库。

4 设置库的权限。下面我们需要设置访问CVS库的用户信息,这里我们需要添加新的用户。在服务器端,设置一下CVSROOT,这里CVSROOT为库所在的目录,如d:\respository\cvs\respo1,然后执行cvs passwd命令即可,如下:

> cvs passwd –a –r administrator username

这样就添加了一个新的访问特定库的新用户。如果不设置CVSROOT,可以通过cvs –d d:\respository\cvs\respo1 直接访问库。关于cvs的passwd的命令,请参考 cvs passwd –help

5 创建CVS 库的管理员,只需将CVS的用户名称写如CVSROOT/admin文件中即可(一行一个用户名称,最后一个用户后添见一个空白行)。其他设置读取或写入权限,只需设置 readers 和 writers文件即可。

6 其他相关的设置,请参考CVS标准设置。

cd CVSROOT
cvs chown cvsadmin   //更改所有者为cvsadmin
cvs chacl default:n   //默认权限为n
cvs chacl cvsadmin:rwc  //添加cvsadmin

cd CVSROOT
cvs chown cvsadmin
cvs chacl -u default -p n
cvs chacl -u cvsadmin -p rwc

Load Balancing For Tomcat

[不指定 2007/08/13 14:39 | by ipaddr ]

要求支持Sticky Session功能,主要有以下几种方案:

Apply Google Apps

[不指定 2007/08/10 23:11 | by ipaddr ]

一直想弄个Google Host来玩玩,以前申请过N次,都被拒绝,Google老是玩这招,不让你那么容易得到,象以前的Gmail.

前几天登录到Gmail,退出后,发现有一个Google Apps的链接,点击去一看,很不错的东东,就是以前的Host服务,现在改名叫Apps了。马上开始申请。

目前还不支持.cn的域名,尝试用eit.name可以通过,但在最3步时,无论选择哪个国家,都提示你不支持,真是郁闷,Google有时还真是无理呢。

后来想想,可能是根据IP来判断的,暂时不对中国用户开放,于是马上登录到美国的服务器,再次申请,一切顺利,哈哈哈哈哈。。。。。。。。。。。。。。。。。。。

解析好eit.name的域名后,会在48小时内生效,可以开通100个用户的使用。真开心。。。。。。。。。。。。

Google真是好东西,最担心就是被封锁。

--------------------------------------------
2009.2更新
--------------------------------------------
目前cn域名仍不能注册,但在注册时,填写域名用xxx.CN (大写CN)也同样可以注册。
如果你从Confluence1.4.X转向Confluence2.1.x,理由很充分,因为2.0提供了一个非常棒的WYSIWYG的界面(所见即所得的界面)。
少废话,破解也是非常简单,首先下载
http://www.blogjava.net/Files/openssl/confluence2.1.4_keygen.rar
然后,解压atlassian-extras-0.7.15.jar到Confluence目录
比如:
D:\confluence-2.1.4-std\confluence\WEB-INF\lib
(覆盖掉这个目录下的atlassian-extras-0.7.xx.jar文件)
然后,
D:\confluence-2.1.4-std\confluence\WEB-INF\lib>java keygen
Keygen for Confluence.
created by TEAM dir/ZWT.
Enter your organization name: aaa
Your license key is:
ORRrxbmEJpuFSekHXocsPbpfRqsQjBdeSELeaoRdsdHcqi
mi2KeNSsv9lIO5c4yNfRqQSd2Keusdo7ufu0TKLYqRuKIa
MmURQnoPmnPprrNpURoNoMPRrnQqQNxtwstqnpQmMPurUn
nqrouunrpvvqUnnqrouunrpvvqUXXXUvssssss


运行Confluence(按照confluence install instruction)
输入上面蓝色的key,即可运行Confluence2.0
2.0感觉很美妙,比1.4强很多。
鉴于直接提供破解文件会影响Blogjava,所以我提供了一个经过加密的破解包
有需要并用于研究性质的朋友请回复Email地址。

c#操作ACCESS数据库

[不指定 2007/08/09 14:43 | by ipaddr ]

手头没有Microsoft Access,如何建立数据库,一切依然简单.
首先引用C:\Program Files\Common Files\System\ado\msadox.dll,该DLL包含ADOX命名空间;
接着引用C:\Program Files\Common Files\System\ado\msjro.dll,该DLL包含JRO命名空间
注意:如,导入dll不成功,手动把com组件导入为 .net组件,在用vs.net工具导入 

using System;
using System.IO;
using ADOX; //该命名空间包含创建ACCESS的类(方法)--解决方案 ==> 引用 ==> 添加引用 ==> 游览找到.dll
using JRO; //该命名空间包含压缩ACCESS的类(方法)

public class Access
...{
/**////根据指定的文件名称创建ACCESS数据库
///mdbPath:要创件的ACCESS绝对路径
public void Create( string mdbPath )
...{
if( File.Exists(mdbPath) ) //检查数据库是否已存在
...{
throw new Exception("目标数据库已存在,无法创建");
}
// 可以加上密码,这样创建后的数据库必须输入密码后才能打开
mdbPath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdbPath;
// 创建一个CatalogClass对象的实例,
ADOX.CatalogClass cat = new ADOX.CatalogClass();
// 使用CatalogClass对象的Create方法创建ACCESS数据库
cat.Create(mdbPath);
}

/**////压缩修复ACCESS数据库,mdbPath为数据库绝对路径
public void Compact( string mdbPath )
...{
if( !File.Exists(mdbPath) ) //检查数据库是否已存在
...{
throw new Exception("目标数据库不存在,无法压缩");
}
//声明临时数据库的名称
string temp = DateTime.Now.Year.ToString();
temp += DateTime.Now.Month.ToString();
temp += DateTime.Now.Day.ToString();
temp += DateTime.Now.Hour.ToString();
temp += DateTime.Now.Minute.ToString();
temp += DateTime.Now.Second.ToString() + ".bak";
temp = mdbPath.Substring(0, mdbPath.LastIndexOf("\")+1) + temp;
//定义临时数据库的连接字符串
temp2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + temp;
//定义目标数据库的连接字符串
mdbPath2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdbPath;
//创建一个JetEngineClass对象的实例
JRO.JetEngineClass jt = new JRO.JetEngineClass();
//使用JetEngineClass对象的CompactDatabase方法压缩修复数据库
jt.CompactDatabase( mdbPath2, temp2 );
//拷贝临时数据库到目标数据库(覆盖)
File.Copy( temp, mdbPath, true );
//最后删除临时数据库
File.Delete( temp );
}

/**//// 备份数据库,mdb1,源数据库绝对路径; mdb2: 目标数据库绝对路径
public void Backup( string mdb1, string mdb2 )
...{
if( !File.Exists(mdb1) )
...{
throw new Exception("源数据库不存在");
}
try
...{
File.Copy( mdb1, mdb2, true );
}
catch( IOException ixp )
...{
throw new Exception(ixp.ToString());
}
}

/**////恢复数据库,mdb1为备份数据库绝对路径,mdb2为当前数据库绝对路径
public void Recover( string mdb1, string mdb2 )
...{
if( !File.Exists(mdb1) )
...{
throw new Exception("备份数据库不存在");
}
try
...{
File.Copy( mdb1, mdb2, true );
}
catch( IOException ixp )
...{
throw new Exception(ixp.ToString());
}
}
}

Getting The Real IP Of Your Users

[不指定 2007/08/06 15:52 | by ipaddr ]

There are a lot of sites around the internet that try and get your IP address. Most of their reasons are legitimate. For example Google Adsense will log your IP to see where the user clicking the advert is from (and kick you off if its the same IP you logged into that account with).

However, there are some sites that try to look at your IP for various reasons but do it wrong. Rapidshare is a beatifully painful example of this. If you're on an ISP that uses a transparent proxy, RapidShare will log the proxy address instead of the actual account IP. As they limit the downloading on a per-IP basis, that means everyone using that ISP, going through that proxy, has the same IP to Rapidshare, meaning the limit to how much you download is split among those users.

Languages

  • VB.net
  • C#
  • PHP
  • Java and JSP
  • ASP/VBScript
  • ColdFusion
  • Perl

What I'm saying here is, if you're going to do your own IP lookups for whatever reason, do them correctly. My initial code here was in VB.net but since I have translated what its doing to the most popular server-side languages. As its based on the server variables, rather than the code's process, its quite easy to port to something else if you need to.

The lookup that these "incorrect" sites are doing is something like this:

Request.ServerVariables("REMOTE_ADDR")


What then need to be doing is comparing the HTTP_X_FORWARDED_FOR variable against it, to check that there isn't a non-transparent proxy in the way. Like so:


' Look for a proxy address first
Dim _ip As String = Request.ServerVariables("HTTP_X_FORWARDED_FOR")

' If there is no proxy, get the standard remote address
If (_ip = "" Or _ip.ToLower = "unknown") Then _
    _ip = Request.ServerVariables("REMOTE_ADDR")

  

This doesnt help people that are limited to (or otherwise) on anonymous proxies. They will hide the forwarding address (like they're supposed to) and therefore the lookup will ONLY get the proxy's address. Some ISPs do this by default to "protect" their users... Its just retarded. If you ISP does this, and you've been wondering why RS or other sites don't work... Now you know.

Here are some more examples in other languages:

C#


// Look for a proxy address first
String _ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
// If there is no proxy, get the standard remote address
If (_ip == "" || _ip.ToLower == "unknown")
    _ip = Request.ServerVariables["REMOTE_ADDR"];

PHP

Based on code from OxyScripts.

/**
* Call as: $userp = GetUserIP();
*/
function GetUserIP() {
    if (isset($_SERVER)) {
        if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
            return $_SERVER["HTTP_X_FORWARDED_FOR"];
       
        if (isset($_SERVER["HTTP_CLIENT_IP"]))
            return $_SERVER["HTTP_CLIENT_IP"];
        return $_SERVER["REMOTE_ADDR"];
    }
    if (getenv('HTTP_X_FORWARDED_FOR'))
        return getenv('HTTP_X_FORWARDED_FOR');
    if (getenv('HTTP_CLIENT_IP'))
        return getenv('HTTP_CLIENT_IP');
    return getenv('REMOTE_ADDR');
}

Java and JSP

String ipaddress = request.getHeader("HTTP_X_FORWARDED_FOR");
if (ipaddress  == null)
   ipaddress = request.getRemoteAddr();

ASP/VBScript


ipaddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if ipaddress = "" then
    ipaddress = Request.ServerVariables("REMOTE_ADDR")
end if

ColdFusion


<CFCOMPONENT>
    <CFIF #CGI.HTTP_X_Forwarded_For# EQ "">
        <CFSET ipaddress="#CGI.Remote_Addr#">
    <CFELSE>
        <CFSET ipaddress="#CGI.HTTP_X_Forwarded_For#">
    </CFIF>
</CFCOMPONENT>

Perl

$IPAddress = $ENV{HTTP_X_FORWARDED_FOR};
if ($IPAddress == "") {
    $IPAddress = $ENV{HTTP_X_FORWARDED_FOR};
}

If you know anymore, just ping them in my general direction and they can be added.


分页: 9/20 第一页 上页 4 5 6 7 8 9 10 11 12 13 下页 最后页 [ 显示模式: 摘要 | 列表 ]