博客 (65)


--------------------
常量:
整型,实型,布尔值,字符串型,null,undefined

变量:var
--------------------
除法运算:9/4 = 2.25 (而不是2)

--------------------
系统函数:
1,encodeURI URL编码
   var urlStr=encodeURI("http://www.abc.com/?country=吴&name=z x");
   结果:http://www.abc.com/?country=%E5%90%B4&name=z%20x
2,decodeURI URL解码
3,parseInt 将字符串按指定进制转换成一个整数,参数二表示进制
   parseInt("32",10) 结果:32
   parseInt("3c2",10) 结果:3
   parseInt("c32",10) 结果:NaN
   parseInt("0x18",10) 结果:0
   parseInt("12",16) 结果18
4,parseFloat 将字符串转成小数
   parseFloat("2.5") 结果:2.5
   parseFloat("2.c5") 结果:2
   parseFloat("c2.5") 结果:NaN
5,isNaN 用于检测parseInt和parseFloat返回是否为NaN
   返回true/false
6,escape 编码
   非ASCII替换为%xx
7,unescape 解码
8,eval 将字符串作为JS表达式执行,例
   for(var i=0;i<3;i++) eval("var a"+i+"="+i);
   相当于:
   var a0=0; var a1=1; var a2=2;
--------------------
对象
1,Object
2,String
   方法:
   indexOf,
   lastIndexOf,
   match,使用正则表达式模式对字符串执行搜索,返回包含该搜索结果的数组
   replace,
   search,使用正则表达式搜索,第一个匹配的字符的位置
   slice,截字符串:参数一,开始位置,参数二,结束位置(不指定或为-1时表示末位置)
   split,返回一个字符串按照某种分隔标志符拆分为若干子字符串时所产生的字符串数组,分隔符可以是多个字符或一个正则表达式,它不作为任何数组元素的一部分返回。
   substr,截字符串:参数一,开始位置,参数二,长度
   toLowerCase,
   toUpperCase,
3,Math(不能用new创建)
   方法:
   abs,绝对值
   sin,cos,正余弦
   asin,acos,反正余弦
   random,返回介于0~1之间的伪随机数
   例:var num = Math.randow();
4,Date
    var currentTime=new Date();
    //var currentTime=new Date(2002,3,4);
    var strDate=currentTime.getYear()+"年";
    strDate+=currentTime.getMonth()+"月";
    strDate+=currentTime.getDate()+"日";
    strDate+=currentTime.getHours()+":";
    strDate+=currentTime.getMinutes()+":";
    strDate+=currentTime.getSeconds()+" ";
    strDate+=currentTime.getMilliseconds();
    alert(strDate);
   结果:2008年1月19日15:27:10 518
----------------------
数组
1,
    var arr=["abc",123,'abc',,3.4];
    for(var i=0;i<arr.length;i++)
    {
        alert(arr[i]);
    }
2,用对象的方式实现数组
    function MyArray(){this.length=arguments.length;for(var i=0;....
3,Array对象
    var arr=new Array(2.4,"abc",2);
    arr.sort(); //排序
    alert的结果为 2 2,4 abc
-----------------------

xoyozo 17 年前
5,255

微软已经开始正式对系统更新的使用者强制检查其所使用的 XP系统是否为盗版的检查,若发现盗版,系统自动更新后,每次启动都提示"您可能是软件盗版的受害者",进入桌面后右下角启动栏里有一个五角星的图案.

相关报道:
即日起微软将启动「正版Windows客户权益独享计划1.0 」 (Windows Genuine Advantage 1.0 , WGA 1.0),用户进入下载中心必须验证是否正版软件,若为盗版软件则不能下载,但是自动更新(Automatic updates)不在此限,所有的用户都可以自动更新修补漏洞。用户在第一次进入Windows update、Microsoft update及Download Center网站进行下载时,将被要求参与WGA验证程序。客户须要下载一个ActiveX控制程序,此程序将自动验证用户计算机所使用的是否为正版 Windows软件。若通过验证,将会有一组Download Key储存在客户计算机中,作为将来进入微软网站进行下载动作时计算机自动辨识之用,微软表示,此验证流程不搜集任何可用来辨认或联络使用者的信息。验证流程已经改善并简化。验证程序将自动验证用户计算机所使用的是否为正版Windows软件,用户不再需键入25码的产品序号,就可以轻松的完成验证过程,大幅降低客户进行验证时的负担。换句话说使用盗版Windows操作系统的用户,将不能直接从下载中心下载Windows Media Player、Antispy等软件,但是依然可以透过自动更新来修补漏洞。


手工解决方法:

方法一:
1.IE => 工具=>Internet 选项 => 程序=> 管理加载项=>IE已经使用的加载项=>Windows Genuine Advantage Validation Tool=>禁用=>然后再上线更新,这样就不会验证了。此WGA(Windows Genuine Advantage Notifications)组件对应文件:legitchechcontrol.dll。WGA是反盗版自动更新验证ActiveX组件,这个正版检验程序植入系统后,会在每次系统启动时,透过网络回报讯息给微软的网站。没更新过的计算机里没有此组件,So..先去update下载此组件后再用此方法去停用此组件,以后即可自动更新了。

2、移除验证码:
计算机=>控制面板=>添加或删除程序=>Windows Installer 3.1(KB893803)=>删除=>重新下载更新档=>windows genuine advantage 不要勾选=>完成。保证不会再出现了(Windows Installer 3.1是修复windows installer安装错误或者提示无法修复MSI出错的微软官方补丁)

3.重启你的计算机,进入安全模式,登陆管理员帐号--保证你拥有进入Windows\system32以及Windows\system32\dllcache路径的权限。在这两个路径下均有一个名为WGATray.EXE的文件。你必须将两个路径下的WGATray.EXE均删除--这将阻止Windows在启动时弹出“盗版XP”气球。
在删除Windows\system32下的WGATray.EXE可能需要一点技巧:
步奏一:WGATray.EXE图标-->右键-->删除-->出现删除确认框后先不要按‘确定’按钮
步奏二:Ctrl+Alt+Del-->打开进程管理器-->找到WGATray.EXE-->删除-->出现删除确认框后先不要按‘确定’按钮
步奏三:先按打开进程管理器的删除确认键,然后用最快速度按步奏一的删除确认键。
步奏四:如果Windows\system32下的WGATray.EXE不会出现,代表操作成功。继续删除Windows\system32\dllcache下的WGATray.EXE。

4.进入注册表,进入
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Windows NT\CurrentVersion\Winlogon\Notify
删除其中的“WGALOGON”文件夹--这将Windows将无法加载任何有关WGA的DLL文件。
重启计算机,你将暂时告别微软正版增值计划的“骚扰”。

方法二:

在进入Window update 网页后选择「Express(快速)」或「Custom(自订)」按钮前,在 IE 地址栏输入:
void(window.g_sDisableWGACheck='all')
再按下ENTER后,再选取你要更新的方法"快速","自订"即可
此法可以用来破解微软反盗版的检查。系统就不会查你是用什么版本的WIN了

能保证系统更新还是很有必要的。系统更新的目的多数就是防止电脑病毒的需要。

对于使用VOL免激活版(上海政府、xx银行等)的用户,可以使用替换序列号的简单办法。因为目前尚有部分VOL序列号未被封,并且可以通过正版验证。
HCQ9D-TVCWX-X9QRG-J4B2Y-GR2TT (番茄花园版就是使用的这个序列号)
MRX3F-47B9T-2487J-KWKMF-RPWBY(工行版)
QC986-27D34-6M3TY-JJXP9-TBGMD(台湾交大学生版)

点击下载此文件

替换后请到C:\Documents and Settings\All Users\Application Data下删除Windows Genuine Advantage文件夹。以后即可通过正版验证。

如果XP是很老的破解版本(比如零售版的破解版本)用户,无法使用上述序列号,请下载RemoveWGA工具。RemoveWGA 是一个专门用来清除 WGA 的小程序,使用者只要通过它,就可以阻止微软的 WGA 在系统每次启动时企图连回微软网站的动作,且使用它并不需要担心微软的正版验证机制,你还是一样能够正常的使用 Windows update 的功能,两者之间并没有任何冲突。虽然系统仍是破解的,但将不会再有任何提示,和以前没有变化。注:该工具会被部分杀毒软件识别为病毒。如须使用,下载前可能需要暂时禁用或者关闭一下病毒防火墙。使用过后再恢复。
华军下载地址:http://www.onlinedown.net/soft/6914.htm

5,517
string chkCode = string.Empty;
//颜色列表,用于验证码、噪线、噪点
//Color[] color ={Color.White, Color.Yellow, Color.LightBlue, Color.LightGreen,
//                Color.Orange, Color.LightCyan, Color.LightPink, 
//                Color.LightSalmon };
Color[] color = {Color.Black, Color.Blue, Color.Red, Color.DarkViolet, 
                 Color.Chocolate, Color.DarkGreen, Color.DeepSkyBlue, 
                 Color.DarkCyan };
//字体列表,用于验证码 
string[] font = {"Times New Roman", "MS Mincho", "Book Antiqua", "Gungsuh",
                 "PMingLiU", "Impact" };
//验证码的字符集,去掉了一些容易混淆的字符 
char[] character ={'2', '3', '4', '5', '6', '8', '9', 'A', 'B', 'C', 'D', 'E',
                   'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T',
                   'W', 'X', 'Y' };
Random rnd = new Random();
//生成验证码字符串 
for (int i = 0; i < 4; i++)
{
    chkCode += character[rnd.Next(character.Length)];
}
//把验证码存入session
Session["chkCode"] = chkCode;
Bitmap bmp = new Bitmap(65, 20);
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Transparent);//背景色
//画噪线 
for (int i = 0; i < 0; i++)
{
    int x1 = rnd.Next(65);
    int y1 = rnd.Next(20);
    int x2 = rnd.Next(65);
    int y2 = rnd.Next(20);
    Color clr = color[rnd.Next(color.Length)];
    g.DrawLine(new Pen(clr), x1, y1, x2, y2);
}
//画验证码字符串
for (int i = 0; i < chkCode.Length; i++)
{
    string fnt = font[rnd.Next(font.Length)];
    Font ft = new Font(fnt, 15);
    Color clr = color[rnd.Next(color.Length)];
    g.DrawString(chkCode[i].ToString(), ft, new SolidBrush(clr),
        (float)i * 15 + 2, (float)0);
}
//画噪点 
for (int i = 0; i < 50; i++)
{
    int x = rnd.Next(bmp.Width);
    int y = rnd.Next(bmp.Height);
    Color clr = color[rnd.Next(color.Length)];
    bmp.SetPixel(x, y, clr);
}
//清除该页输出缓存,设置该页无缓存 
Response.Buffer = true;
Response.ExpiresAbsolute = System.DateTime.Now.AddMilliseconds(0);
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.AppendHeader("Pragma", "No-Cache");
//将验证码图片写入内存流,并将其以 "image/Png" 格式输出 
MemoryStream ms = new MemoryStream();
try
{
    bmp.Save(ms, ImageFormat.Png);
    Response.ClearContent();
    Response.ContentType = "image/Png";
    Response.BinaryWrite(ms.ToArray());
}
finally
{
    //显式释放资源 
    bmp.Dispose();
    g.Dispose();
}
xoyozo 17 年前
5,464

CatalogEdit.aspx

<asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource1" DataTextField="catalog"
DataValueField="ID" Rows="10"></asp:ListBox>
<asp:LinkButton ID="LinkButton_up" runat="server" OnClick="LinkButton_up_Click">上移</asp:LinkButton>
<asp:LinkButton ID="LinkButton_down" runat="server" OnClick="LinkButton_down_Click">下移</asp:LinkButton>
<asp:LinkButton ID="LinkButton_del" runat="server" OnClick="LinkButton_del_Click">删除</asp:LinkButton>
<asp:Label ID="Label_alert" runat="server" ForeColor="Red" Text="Label"></asp:Label><br />
<asp:TextBox ID="TextBox_newCatalog" runat="server"></asp:TextBox>
<asp:LinkButton ID="LinkButton_add" runat="server" OnClick="LinkButton_add_Click">新增</asp:LinkButton>
<asp:LinkButton ID="LinkButton_edit" runat="server" OnClick="LinkButton_edit_Click">修改</asp:LinkButton>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringLink %>"
DeleteCommand="DELETE FROM [xLinkCategory] WHERE [ID] = ?" InsertCommand="INSERT INTO [xLinkCategory] ([username],[catalog],[order]) VALUES (?,?,0)"
ProviderName="<%$ ConnectionStrings:ConnectionStringLink.ProviderName %>"
SelectCommand="SELECT [ID], [catalog] FROM [xLinkCategory] WHERE ([username] = ?) ORDER BY [order],[ID] desc"
UpdateCommand="UPDATE [xLinkCategory] SET [catalog] = ? WHERE [ID] = ?">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="catalog" Type="String" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:SessionParameter Name="username" SessionField="username" Type="String" />
</SelectParameters>
<InsertParameters>
<asp:SessionParameter Name="username" SessionField="username" Type="String" />
<asp:Parameter Name="catalog" Type="String" />
</InsertParameters>
</asp:SqlDataSource>

CatalogEdit.aspx.cs

/**//// <summary>
/// 上移
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void LinkButton_up_Click(object sender, EventArgs e)
{
if (ListBox1.SelectedItem != null && ListBox1.SelectedIndex > 0)
{
string tempValue = ListBox1.SelectedValue;
string tempText = ListBox1.SelectedItem.Text;
int index = ListBox1.SelectedIndex;

ListBox1.SelectedItem.Value = ListBox1.Items[index - 1].Value;
ListBox1.SelectedItem.Text = ListBox1.Items[index - 1].Text;
ListBox1.Items[index - 1].Value = tempValue;
ListBox1.Items[index - 1].Text = tempText;

ListBox1.SelectedIndex--;

operateDB_move();
}
}
/**//// <summary>
/// 下移
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void LinkButton_down_Click(object sender, EventArgs e)
{
if (ListBox1.SelectedItem != null && ListBox1.SelectedIndex < ListBox1.Items.Count - 1)
{
string tempValue = ListBox1.SelectedValue;
string tempText = ListBox1.SelectedItem.Text;
int index = ListBox1.SelectedIndex;

ListBox1.SelectedItem.Value = ListBox1.Items[index + 1].Value;
ListBox1.SelectedItem.Text = ListBox1.Items[index + 1].Text;
ListBox1.Items[index + 1].Value = tempValue;
ListBox1.Items[index + 1].Text = tempText;

ListBox1.SelectedIndex++;

operateDB_move();
}
}
/**//// <summary>
/// 添加
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void LinkButton_add_Click(object sender, EventArgs e)
{
if (TextBox_newCatalog.Text != "")
{
//检查同名
bool goon = true;
foreach (ListItem li in ListBox1.Items)
{
if (li.Text == TextBox_newCatalog.Text)
{
goon = false;
}
}

if (goon)
{
//操作
SqlDataSource1.InsertParameters["catalog"].DefaultValue = TextBox_newCatalog.Text;
SqlDataSource1.Insert();

//设置selected
if (ListBox1.Items.Count > 0)
{
ListBox1.SelectedIndex = 0;
}
}
else
{
Label_alert.Text = "已存在";
}
}
}
/**//// <summary>
/// 修改
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void LinkButton_edit_Click(object sender, EventArgs e)
{
if (TextBox_newCatalog.Text != "" && ListBox1.SelectedItem != null)
{
int index = ListBox1.SelectedIndex;

//检查同名
bool goon = true;
foreach (ListItem li in ListBox1.Items)
{
if (li.Text == TextBox_newCatalog.Text)
{
goon = false;
}
}

if (goon)
{
//操作
SqlDataSource1.UpdateParameters["catalog"].DefaultValue = TextBox_newCatalog.Text;
SqlDataSource1.UpdateParameters["ID"].DefaultValue = ListBox1.SelectedItem.Value;
SqlDataSource1.Update();

//设置selected
ListBox1.SelectedIndex = index;
}
else
{
Label_alert.Text = "已存在";
}
}
}
/**//// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void LinkButton_del_Click(object sender, EventArgs e)
{
if (ListBox1.SelectedItem != null)
{
int index = ListBox1.SelectedIndex;
int count = ListBox1.Items.Count;

//检查该 Catalog 下是否有 Link
bool goon = true;
goon = !checkSubLink(ListBox1.SelectedValue); //下有 Link 则返回真,注意前面有个"!",有则不继续

if (goon)
{
//操作
SqlDataSource1.DeleteParameters["ID"].DefaultValue = ListBox1.SelectedItem.Value;
SqlDataSource1.Delete();

//设置selected
if (index < count - 1) //删的不是最末项
{
ListBox1.SelectedIndex = index;
}
if (index == count - 1 && index != 0) //删的是最末项,并且不是最首项
{
ListBox1.SelectedIndex = index - 1;
}
if (index == count - 1 && index == 0) //删的是最末项,并且是最首项
{
//不设索引
}
}
else
{
Label_alert.Text = "该节点下面存在Link(s),请删除后再删除该节点!";
}
}
}
xoyozo 17 年前
4,034
public static bool loadRss(string RssUrl, int RssCount)
{
bool ok = true;
XmlDocument doc = new XmlDocument();
if (RssUrl != "")
{
try
{
doc.Load(RssUrl);
XmlNodeList nodelist = doc.GetElementsByTagName("item");
XmlNodeList objItems1;

int i = 0;
int count = 0;

if (doc.HasChildNodes)
{
foreach (XmlNode node in nodelist)
{
string title = "";
string link = "";
string description = "";
string pubDate = "";
i += 1;
if (node.HasChildNodes)
{
objItems1 = node.ChildNodes;
foreach (XmlNode node1 in objItems1)
{
switch (node1.Name)
{
case "title":
title = node1.InnerText;
break;
case "link":
link = node1.InnerText;
break;
case "description":
description = node1.InnerText;
break;
case "pubDate":
pubDate = node1.InnerText;
break;
default: break;
}
}
}
if (i > RssCount)
{
break;
}
}
}
}
catch (Exception ex)
{
ok = false;
}
}

return ok;
}
xoyozo 17 年前
4,823