public static Hashtable xml_unserialize(string strXml)
{
//加上下面这句就好了
strXml = strXml.Replace("&", "&");
Hashtable ht = new Hashtable();
XmlDocument XMLDom = new XmlDocument();
XMLDom.LoadXml(strXml);
XmlNode newXMLNode = XMLDom.SelectSingleNode("root");
int i = 0;
foreach (XmlNode xn in newXMLNode.ChildNodes)
{
ht.Add(i++, xn.InnerText);
}
return ht;
}
> 和 < 这类字符是XML 标记字符,在 XML 中有特殊的含义。当在 SQL 查询(或 XPath 查询)中指定这些字符时,必须对它们进行适当的编码(也称为实体编码)。下表列出了这些特殊字符并描述了它们的含义。有关更多信息,请参见 XML 1.0 规范 中的 XML 1.0 规范。
特殊字符 特殊含义 实体编码
> 开始标记 >
< &n ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//导入使用xml应用所需的命名空间
using System.Xml.XPath;
using System.Xml;
using System.IO;
using System.Xml.Xsl;
public partial class login0 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void btnok_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();//新建数据集对象
ds.ReadXml(Server.MapPath("ad/user.xml"));//使用该对象的ReadXml()方法访问xml文件
&nb ......
这个程序仅供编程参考
若想在平时用,请下载微软的wallpaper changer
我这个程序实现了定时更换桌面背景的功能
命令行 wallpaper "your images' directory path" time_in_minute
编程要点
findfirstfile findnextfile 查找图像文件
SystemParametersInfo 修改系统信息,在这儿当然是桌面背景
注册表操作 保存信息
如果做得实用,应加入开机启动功能,自然还要gui
//wallpaper.c
//by onezeros@yahoo.cn||Zhijie Lee
//usage:wallpaper "full directory path" interval
// interval is in minutes
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
/* argc=3;
argv[1]="E:\\picture\\testbmp";
argv[2]="1";
*/ LPCSTR currentDir;
LPCSTR currentImage;
int interval;
HKEY hKey;
WIN32_FIND_DATAA FileData;
HANDLE hFind;
//initialize parameters
if(argc==1){
//find parameters in registry
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,(LPCSTR)"Software\\wallpaper",
&hKey)!=ERROR_SUCCESS||
RegQueryValue ......
这个程序仅供编程参考
若想在平时用,请下载微软的wallpaper changer
我这个程序实现了定时更换桌面背景的功能
命令行 wallpaper "your images' directory path" time_in_minute
编程要点
findfirstfile findnextfile 查找图像文件
SystemParametersInfo 修改系统信息,在这儿当然是桌面背景
注册表操作 保存信息
如果做得实用,应加入开机启动功能,自然还要gui
//wallpaper.c
//by onezeros@yahoo.cn||Zhijie Lee
//usage:wallpaper "full directory path" interval
// interval is in minutes
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
/* argc=3;
argv[1]="E:\\picture\\testbmp";
argv[2]="1";
*/ LPCSTR currentDir;
LPCSTR currentImage;
int interval;
HKEY hKey;
WIN32_FIND_DATAA FileData;
HANDLE hFind;
//initialize parameters
if(argc==1){
//find parameters in registry
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,(LPCSTR)"Software\\wallpaper",
&hKey)!=ERROR_SUCCESS||
RegQueryValue ......
#define _________ }
#define ________ putchar
#define _______ main
#define _(a) ________(a);
#define ______ _______(){
#define __ ______ _(0x48)_(0x65)_(0x6C)_(0x6C)
#define ___ _(0x6F)_(0x2C)_(0x20)_(0x77)_(0x6F)
#define ____ _(0x72)_(0x6C)_(0x64)_(0x21)
#define _____ __ ___ ____ _________
#include<stdio.h>
#include<stdio.h>
main(){
int x=0,y[14],*z=&y;*(z++)=0x48;*(z++)=y[x++]+0x1D;
*(z++)=y[x++]+0x07;*(z++)=y[x++]+0x00;*(z++)=y[x++]+0x03;
*(z++)=y[x++]-0x43;*(z++)=y[x++]-0x0C;*(z++)=y[x++]+0x57;
*(z++)=y[x++]-0x08;*(z++)=y[x++]+0x03;*(z++)=y[x++]-0x06;
*(z++)=y[x++]-0x08;*(z++)=y[x++]-0x43;*(z++)=y[x]-0x21;
x=*(--z);while(y[x]!=NULL)putchar(y[x++]);
}
(VS2003编译通过)
#include<stdio.h>
#define __(a) goto a;
#define ___(a) putchar(a);
#define _(a,b) ___(a) _ ......
1.
引言
C++
语言的创建初衷是“a better C”
,但是这并不意味着C++
中类似C
语言的全局变量和函数所采用的编译和连接方式与C
语言完全相同。作 为一种欲与C
兼容的语言,C++
保留了一部分过程式语言的特点(被世人称为“
不彻底地面向对象”
),因而它可以定义不属于任何类的全局变量和函数。但 是,C++
毕竟是一种面向对象的程序设计语言,为了支持函数的重载,C++
对全局函数的处理方式与C
有明显的不同。
2.
从标准头文件说起
某企业曾经给出如下的一道面试题:
面试题
为什么标准头文件都有类似以下的结构?
#ifndef __INCvxWorksh
#define __INCvxWorksh
#ifdef __cplusplus
extern "C" {
#endif
/*...*/
#ifdef __cplusplus
}
#endif
#endif /* __INCvxWorksh */
分析
显然,头文件中的编译宏“#ifndef __INCvxWorksh
、#define __INCvxWorksh
、#endif”
的作用是防止该头文件被重复引用。
那么
#ifdef __cplusplus
extern &quo ......
1.
引言
C++
语言的创建初衷是“a better C”
,但是这并不意味着C++
中类似C
语言的全局变量和函数所采用的编译和连接方式与C
语言完全相同。作 为一种欲与C
兼容的语言,C++
保留了一部分过程式语言的特点(被世人称为“
不彻底地面向对象”
),因而它可以定义不属于任何类的全局变量和函数。但 是,C++
毕竟是一种面向对象的程序设计语言,为了支持函数的重载,C++
对全局函数的处理方式与C
有明显的不同。
2.
从标准头文件说起
某企业曾经给出如下的一道面试题:
面试题
为什么标准头文件都有类似以下的结构?
#ifndef __INCvxWorksh
#define __INCvxWorksh
#ifdef __cplusplus
extern "C" {
#endif
/*...*/
#ifdef __cplusplus
}
#endif
#endif /* __INCvxWorksh */
分析
显然,头文件中的编译宏“#ifndef __INCvxWorksh
、#define __INCvxWorksh
、#endif”
的作用是防止该头文件被重复引用。
那么
#ifdef __cplusplus
extern &quo ......
从天堂走向地狱的六部... 1
第一步、把for变成while. 2
第二步,把循坏变成递归... 2
第三步,弄乱代码结构/使用没有含义的变量名... 3
第四步,取消临时变量... 3
第五步,继续弄乱变量名... 4
第六步,移除常量... 4
从天堂走向地狱的六部
开始程序
下面是一个找出素数的程序:
查看源代码打印帮助
void primes(int cap)
{
int i, j, composite;
for(i = 2; i < cap; ++i) {
composite = 0;
for(j = 2; j * j < i; ++j) {
composite += !(i % j);
}
if(!composite){
printf("%dt", i);
& ......