2008年2月2日 星期六

共享軟體使用協議範例

XXXX是一款共享軟體。作者享有一切權利。 您可以自由使用、複製、傳播、發布此軟體的未註冊版;未經作者書面認可,任何人不得作任何修改或用於商業用途。違者作者將追究其最大責任。

  請仔細閱讀以下使用許可,如果您不同意以下任何一點,請立即停止使用此軟體:

1.本軟體產品的版權歸XXXXX所有,受到適用版權法及其他知識產權法及條約的保護。
2.軟體作者XXXXXX授予您對此版本的最終用戶使用許可權。
3.擔保責任:使用本軟體產品是您在充分了解本軟體特性基礎上進行的,故由您自已承擔使用本軟體可能造成的風險。在適用法律所許可的最大範圍內,作者不承認任何明示或默示的擔保或條件。
4.無賠償責任:使用本軟體產品是您在充分了解本軟體特性基礎上進行的,故由您自已承擔使用本軟體可能造成的損失。在適用法律所許可的最大範圍內,作者不承擔使用此軟體版本所造成的任何損失。
5.您不能對此軟體作任何的軟體反向工程,如反匯編,跟蹤等。
6.您可以自由使用、複製、傳播、發布此軟體的未注冊版,但未徵得作者同意的情況下,您不能收取任何費用或用於商業目的,如銷售,捆綁,集成等。同時,必須保証所分發的軟體包含全部檔案,并且未作任何修改。
7.你可以長期使用本軟體的未註冊版,但是生成的錄影檔案中會有“未註冊”等字樣。

您一旦傳播、安裝、複製或以其它方式使用《螢幕錄影專家》,即表示您同意接受以上各項條件的約束。如您不同意以上條件的約束,請不要傳播、安裝或使用該軟體。

公司資訊
連絡電話、網址

2008年1月9日 星期三

將ANSI編碼的文字轉為Unicode

source 來源:啟隆
Response.Write(Util.Big52Unicode(tt));
///
/// ANSI轉Unicode
///

///
///
public static string Big52Unicode(string str)
{
new Regex("&#(?[^;]+)", RegexOptions.IgnoreCase);
Match mc = re.Match(str);
while (mc.Success)
{
int S = Convert.ToInt32(mc.Result("${pp}"));
string newS = Char.ConvertFromUtf32(S);
//HttpContext.Current.Response.Write(Char.ConvertFromUtf32(S) +
"
");
str = str.Replace("&#" + S + ";", newS);
mc = mc.NextMatch();
}

return str;
}

完整備份SQLServer

http://www.sqldbatips.com/showarticle.asp?ID=37

using Microsoft.SqlServer.Management.Smo;

namespace SMOTest
{
class Program
{
static void Main()
{
Server svr = new Server();
Backup bkp = new Backup();
bkp.Devices.AddDevice(@"C:\SMOTest.bak", DeviceType.File);
bkp.Database = "SMO";
bkp.Action = BackupActionType.Database;
bkp.Initialize = true;
bkp.PercentCompleteNotification = 10;
bkp.PercentComplete += new PercentCompleteEventHandler(bkp_PercentComplete);
bkp.SqlBackup(svr);
}

static void bkp_PercentComplete(object sender, PercentCompleteEventArgs e)
{
Console.WriteLine(e.Percent.ToString() + "% backed up");
}
}
}

2007年12月30日 星期日

FCKEditor Function List

* Function AttachToOnSelectionChange (functionPointer)

* Function CleanAndPaste (html)

* Function CreateElement (tag)

* Function CreateLink (government payments are capped)

* Function ExecOnSelectionChange ()

//Fires OnSelectionChange event in event manager

* Function ExecOnSelectionChangeTimer ()

* Function ExecuteNamedCommand (commandName, commandParameter)

* Function ExecuteRedirectedNamedCommand (commandName, commandParameter)

* Focus function ()

* Function GetHTML (format) 4003rd doesnt work. Use GetXHTML instead.

* Function GetNamedCommandState (commandName)

* Function GetNamedCommandValue (commandName)

* Function GetXHTML (format) * Function InitializeBehaviors ()

* Function InsertElement (element)

* Function InsertElementAndGetIt (e)

* Function InsertHtml (html)

* Function MakeEditable ()

* Function OnDoubleClick (element)

* Paste function ()

* Function PasteAsPlainText ()

* Function PasteFromWord ()

* Preview function ()

* Function RegisterDoubleClickHandler (handlerFunction, tag)

* Function SetHTML (html, forceWYSIWYG)

* Function SetStatus ()

* Function ShowContextMenu (x, y)

* Function SwitchEditMode ()

* Function UpdateLinkedField ()

2007年5月22日 星期二

ADSL撥號程式-程式蒐集區

ADSL自動撥號程式:作者:佚名
SourceAddress:http://whx.tzgt.gov.cn/newshow/newBodyShow.aspx?articleID=879

RASDisplay ras = new RASDisplay();
ras.Disconnect();//断线
ras.Connect("adsl");//拨号


using System;
using System.Runtime.InteropServices;
public struct RASCONN
{
public int dwSize;
public IntPtr hrasconn;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=257)]
public string szEntryName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=17)]
public string szDeviceType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=129)]
public string szDeviceName;
}

[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Auto)]
public struct RasStats
{
public int dwSize;
public int dwBytesXmited;
public int dwBytesRcved;
public int dwFramesXmited;
public int dwFramesRcved;
public int dwCrcErr;
public int dwTimeoutErr;
public int dwAlignmentErr;
public int dwHardwareOverrunErr;
public int dwFramingErr;
public int dwBufferOverrunErr;
public int dwCompressionRatioIn;
public int dwCompressionRatioOut;
public int dwBps;
public int dwConnectionDuration;
}

[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Auto)]
public struct RasEntryName
{
public int dwSize;
//[MarshalAs(UnmanagedType.ByValTStr,SizeConst=(int)RasFieldSizeConstants.RAS_MaxEntryName + 1)]
public string szEntryName;
//#if WINVER5
// public int dwFlags;
// [MarshalAs(UnmanagedType.ByValTStr,SizeConst=260+1)]
// public string szPhonebookPath;
//#endif
}
public class RAS

{


[DllImport("RaSAPi32.dll", EntryPoint="RasEnumConnectionsA",
SetLastError=true)]

internal static extern int RasEnumConnections
(
ref RASCONN lprasconn, // buffer to receive connections data
ref int lpcb, // size in bytes of buffer
ref int lpcConnections // number of connections written to buffer
);


[DllImport("rasapi32.dll",CharSet=CharSet.Auto)]
internal static extern uint RasGetConnectionStatistics(
IntPtr hRasConn, // handle to the connection
[In,Out]RasStats lpStatistics // buffer to receive statistics
);
[DllImport("rasapi32.dll",CharSet=CharSet.Auto)]
public extern static uint RasHangUp(
IntPtr hrasconn // handle to the RAS connection to hang up
);

[DllImport("rasapi32.dll",CharSet=CharSet.Auto)]
public extern static uint RasEnumEntries (
string reserved, // reserved, must be NULL
string lpszPhonebook, // pointer to full path and
// file name of phone-book file
[In,Out]RasEntryName[] lprasentryname, // buffer to receive
// phone-book entries
ref int lpcb, // size in bytes of buffer
out int lpcEntries // number of entries written
// to buffer
);

[DllImport("wininet.dll",CharSet=CharSet.Auto)]
public extern static int InternetDial(
IntPtr hwnd,
[In]string lpszConnectoid,
uint dwFlags,
ref int lpdwConnection,
uint dwReserved
);

public RAS()
{

}


}
public enum DEL_CACHE_TYPE //要删除的类型。
{
File,//表示internet临时文件
Cookie //表示Cookie
};
public class RASDisplay
{
[DllImport("wininet.dll",CharSet=CharSet.Auto)]
public static extern bool DeleteUrlCacheEntry(
DEL_CACHE_TYPE type
);
private string m_duration;
private string m_ConnectionName;
private string[] m_ConnectionNames;
private double m_TX;
private double m_RX;
private bool m_connected;
private IntPtr m_ConnectedRasHandle;

RasStats status = new RasStats();
public RASDisplay()
{
m_connected = true;

RAS lpras = new RAS();
RASCONN lprasConn = new RASCONN();

lprasConn.dwSize = Marshal.SizeOf(typeof(RASCONN));
lprasConn.hrasconn = IntPtr.Zero;

int lpcb = 0;
int lpcConnections = 0;
int nRet = 0;
lpcb = Marshal.SizeOf(typeof(RASCONN));


nRet = RAS.RasEnumConnections(ref lprasConn, ref lpcb, ref
lpcConnections);


if(nRet != 0)

{
m_connected = false;
return;

}

if(lpcConnections > 0)
{


//for (int i = 0; i < stats =" new" m_connectedrashandle =" lprasConn.hrasconn;" m_connectionname =" lprasConn.szEntryName;" hours =" 0;" minutes =" 0;" seconds =" 0;" hours =" ((stats.dwConnectionDuration" minutes =" ((stats.dwConnectionDuration" seconds =" ((stats.dwConnectionDuration" m_duration =" Hours" m_tx =" stats.dwBytesXmited;" m_rx =" stats.dwBytesRcved;" m_connected =" false;" lpnames =" 1;" entrynamesize =" 0;" lpsize =" 0;" names =" null;" entrynamesize="Marshal.SizeOf(typeof(RasEntryName));" lpsize="lpNames*entryNameSize;" names="new" dwsize="entryNameSize;" retval =" RAS.RasEnumEntries(null,null,names,ref"> 1)
{
names=new RasEntryName[lpNames];
for(int i=0;i0)
{
for(int i=0;i {

m_ConnectionNames[i] = names[i].szEntryName;

}
}
}

public string Duration
{
get
{
return m_connected ? m_duration : "";
}
}

public string[] Connections
{
get
{
return m_ConnectionNames;
}
}

public double BytesTransmitted
{
get
{
return m_connected ? m_TX : 0;
}
}
public double BytesReceived
{
get
{
return m_connected ? m_RX : 0;

}
}
public string ConnectionName
{
get
{
return m_connected ? m_ConnectionName : "";
}
}
public bool IsConnected
{
get
{
return m_connected;
}
}

public int Connect(string Connection)
{
int temp = 0;
uint INTERNET_AUTO_DIAL_UNATTENDED = 2;
int retVal = RAS.InternetDial(IntPtr.Zero,Connection,INTERNET_AUTO_DIAL_UNATTENDED,ref temp,0);
return retVal;
}
public void Disconnect()
{
RAS.RasHangUp(m_ConnectedRasHandle);
}
}