-
2005年10月23日
双机互连共享上网备忘
PC装双网卡,一网卡与Notebook通过双机互连的网线相连,另一网卡通过普通网线与Modem相连。
在Modem的连接(一般为Vnet_PPPoE)属性中“共享”选上“启用此连接的Internet连接共享”,“对于局域网”选与Notebook相连的连接。
两个连接的网关都不用设。与Modem相连的连接要设置为自动获取IP。与Notebook相连的连接的ip要设为192.168.0.1。
-
2005年10月19日
javadbf中文问题的解决
前面shuyanxu朋友提到javadbf(http://fireshort.blogbus.com/logs/2005/09/1420670.html)的中文支持问题,由于我测试得不够仔细就忽略掉了。最近发现读取中文是没有问题的,但写入dbf的时候就会产生乱码。
设了几个断点之后跟踪发现是Utils中的textPadding方法有错,原来的方法是
代码: public static byte[] textPadding( String text, String characterSetName, int length, int alignment,
byte paddingByte) throws java.io.UnsupportedEncodingException {
if( text.length() >= length) {
return text.substring( 0, length).getBytes( characterSetName);
}
byte byte_array[] = new byte[ length];
Arrays.fill( byte_array, paddingByte);
switch( alignment) {
case ALIGN_LEFT:
System.arraycopy( text.getBytes( characterSetName), 0, byte_array, 0, text.length());
break;
case ALIGN_RIGHT:
int t_offset = length - text.length();
System.arraycopy( text.getBytes( characterSetName), 0, byte_array, t_offset, text.length());
break;
}
return byte_array;
}
我改为了代码: public static byte[] textPadding(String text,String characterSetName,
int length,int alignment,byte paddingByte)
throws java.io.UnsupportedEncodingException
{
byte[] srcByteArray=text.getBytes(characterSetName);
byte[] dstByteArray=new byte[length];
Arrays.fill(dstByteArray,paddingByte);
int dstLength=0;
if(srcByteArray.length>=length)
{
dstLength=length%2==0?length:length-1;
}else
{
dstLength=srcByteArray.length;
}
switch(alignment)
{
case ALIGN_LEFT:
System.arraycopy(srcByteArray,0,dstByteArray,0,dstLength);
break;
case ALIGN_RIGHT:
System.arraycopy(srcByteArray,0,dstByteArray,length-dstLength,dstLength);
break;
}
return dstByteArray;
}
中文输出完全正常了。 -
2005年10月18日
结合ToolAgent与自定义数据类型实现下拉列表
Geeta的总结:
1. Using JaWE, defined in xpdl a new "Type declartion". Relevant props: Id="AgentListType", Type="External reference" and "Location=com.intellicare.shaleNShark.model.AgentListType"
2. Defined a new application "AgentListApp" with one formal param called "listParam", Mode="in and Out", type="Declared Type", and SubType="AgentListType"
3. Defined a new wfdata variable called "agentListWf", with type="declared type" and Subtype="AgentListType".
4. Finally, mapped the tool to my activity to an application "AgentListApp" in the usual way, with AppName as com.intellicare.shark.toolagent.AgentListToolAgent and mapping the formal to actual param etc again as usual.
the rest is easy: com.intellicare.shaleNShark.model.AgentListType is a class with just one attribute, String[].
com.intellicare.shark.toolagent.AgentListToolAgent has an public static void execute(AppParameter param1) which calls appropraite methods to populate my list of agnets, create a AgentListType object aList, then set the (in and out) param param1 with: param1.the_value = aList;
You should be able to do something very similar and thus avoid having to use servlets etc.. -
2005年10月09日
发送快捷方式到指定的文件夹
今天无意中搜索到自己的一篇文章,当初投给vckbase,不过他们完全没有给我回应,后来就忘了这事,没想到他们已经登在网上了:http://www.vckbase.com/document/viewdoc/?id=803。
近日下载的电影、连续剧比较多,磁盘空间又不太够,每个盘都摆了不少东西,结果在C盘看完第2集,可能要找到I盘才找得到第3集。后来想到在硬盘上的任何地方,都可以用发送到桌面快捷方式的方法在桌面创建指向文件和文件夹的快捷方式。但我不喜欢桌面充满凌乱的图标,那能不能搞一个类似发送到桌面快捷方式,不过是发送到我指定的文件夹,如“H:\Movie”这样的东东呢?先看看桌面快捷方式这个文件,发现这个文件大小为0字节,再用UltraEdit打开,发现其真正的文件是是“桌面快捷方式.desklink”,原来奥妙在扩展名上,只要扩展名为.desklink,前面的文件名不管是什么,所创建的快捷方式都是放在桌面上的。看来这种方法是行不通了。但是这么一点小东西不太想拿VC,DELPHI之类的屠龙刀出来搞。刚好这几天看了WSH方面的文章,就查查资料,很快就搞出来了。只要将下面的内容保存为CreateMyShortCut.vbs(当然其他的名字也是可以的,扩展名则必须为vbs),根据个人需要修改目标文件夹strDestination,并将其放在 SendTo目录下,就可以将任意的文件夹、文件的快捷方式发送到下面strDesination指定的文件夹了。
''=========================================================== '' '' NAME: <CreateMyShortCut.vbs> '' '' AUTHOR: Ivan Chen , Zsu '' DATE : 2003-5-12 '' '' COMMENT: <comment> '' ''============================================================= Const strDestination = "H:\Movie\" Set objArgs = WScript.Arguments Set WshShell = WScript.CreateObject("WScript.Shell") For i = 0 to objArgs.Count - 1 '' Loop through all arguments. strShortCut = strDestination & "\" & GetAName(objArgs(i)) & ".lnk" set oShellLink = WshShell.CreateShortcut(strShortCut) oShellLink.TargetPath = objArgs(i) oShellLink.WindowStyle = 1 ''oShellLink.Description = "Created By Ivan Chen" oShellLink.WorkingDirectory = Left(objArgs(i), InStrRev(objArgs(i), "\")) oShellLink.Save Next Function GetAName(DriveSpec) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") GetAName = fso.GetFileName(DriveSpec) End Function ''end







