对粉尘螨、屋尘螨过敏应注意什么?怎么治疗?
作者:nz.perfectaction 日期:2008-08-20
螨虫在湿度低于15%的干燥环境中就会死亡,在低温的环境中无法进一步繁殖。因此,即使现在它们对传统杀虫剂越来越具备适应性和抵抗力,以至无法被彻底杀灭,但搞好家庭和个人清洁卫生,仍不失为经济有效的除虫办法。
具体方法是经常保持居室和工作室的通风干燥,勤换洗衣服、被褥,定期曝晒、拍打被褥、床垫、枕芯、草席和地毯等物品。在春夏季,经常将草、竹席放在太阳下晾晒、拍打,或用75%乙醇擦拭,或将樟脑精块等芳香驱虫品放在床垫或席子下。经常用吸尘器吸除地毯上的灰尘,还可以用除虫菊酯醚类的除虫剂喷洒在地毯上,或用棉纱蘸松节油擦拭地毯。最好不要让宠物进卧室,并定期给宠物洗澡和驱虫、消毒。
下面是具体资料
主讲:魏庆宇 博士
减少生活和工作和环境中尘螨的含量对尘螨过敏患者来说非常重要,可以通过控制措施减少吸入尘螨鳞片及排泄物的量,来预防和减轻发病,减少发病次数。尘螨最适宜的生存条件是温度17~30℃,相对湿度75%~80%,屋尘螨以人体或动物脱落的皮屑为食,在床铺上和卧室地毯中繁殖较快,一个人每日产生0.7克左右皮屑。粉尘螨以...
具体方法是经常保持居室和工作室的通风干燥,勤换洗衣服、被褥,定期曝晒、拍打被褥、床垫、枕芯、草席和地毯等物品。在春夏季,经常将草、竹席放在太阳下晾晒、拍打,或用75%乙醇擦拭,或将樟脑精块等芳香驱虫品放在床垫或席子下。经常用吸尘器吸除地毯上的灰尘,还可以用除虫菊酯醚类的除虫剂喷洒在地毯上,或用棉纱蘸松节油擦拭地毯。最好不要让宠物进卧室,并定期给宠物洗澡和驱虫、消毒。
下面是具体资料
主讲:魏庆宇 博士
减少生活和工作和环境中尘螨的含量对尘螨过敏患者来说非常重要,可以通过控制措施减少吸入尘螨鳞片及排泄物的量,来预防和减轻发病,减少发病次数。尘螨最适宜的生存条件是温度17~30℃,相对湿度75%~80%,屋尘螨以人体或动物脱落的皮屑为食,在床铺上和卧室地毯中繁殖较快,一个人每日产生0.7克左右皮屑。粉尘螨以...
ip地址转数值
作者:nz.perfectaction 日期:2008-08-19
ASP/Visual Basic代码
- Function ChangeIP(ip)
- strIP=Split(ip,".")
- ChangeIP=int(strIP(0))*16777216 + int(strIP(1)) *65536 + int(strIP(2))*256 +int(strip(3))
- End Function
SQL代码
- create function dbo.f_ip2int(
- @ip char(15)
- )returns bigint
- as
- begin
- declare @re bigint
- set @re=0
- select @re=@re+left(@ip,charindex('.',@ip+'.')-1)*id
- ,@ip=stuff(@ip,1,charindex('.',@ip+'.'),'')
- from(
- select id=cast(16777216 as bigint)
- union all select 65536
- union all select 256
- union all select 1)a
- return(@re)
- end
(C# )Ftp的操作
作者:nz.perfectaction 日期:2008-08-18
C#代码
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Diagnostics;
- using System.Text.RegularExpressions;
- //从ftp上下载文件
- private void Download(string filePath, string ImageSrc, string ImageName, string ftpServerIP, string
- ftpUserName, string ftpPwd)
- {
- if (!Directory.Exists(filePath))
- {
- Directory.CreateDirectory(filePath);
- }
- using (FileStream OutputStream = new FileStream(filePath + "\\" + ImageName, FileMode.Create))
- {
- FtpWebRequest ReqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" +
- ImageSrc));
- ReqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
- ReqFTP.UseBinary = true;
- ReqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPwd);
- using (FtpWebResponse response = (FtpWebResponse)ReqFTP.GetResponse())
- {
- using (Stream FtpStream = response.GetResponseStream())
- {
- long Cl = response.ContentLength;
- int bufferSize = 2048;
- int readCount;
- byte[] buffer = new byte[bufferSize];
- readCount = FtpStream.Read(buffer, 0, bufferSize);
- while (readCount > 0)
- {
- OutputStream.Write(buffer, 0, readCount);
- readCount = FtpStream.Read(buffer, 0, bufferSize);
- }
- FtpStream.Close();
- }
- response.Close();
- }
- OutputStream.Close();
- }
- }
- //从服务器上传文件到FTP上
- private void UploadSmall(string sFileDstPath, string FolderName, string ftpServerIP, string ftpUserName,
- string ftpPwd)
- {
- FileInfo fileInf = new FileInfo(sFileDstPath);
- FtpWebRequest reqFTP;
- reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + FolderName + "/" +
- fileInf.Name));
- reqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPwd);
- reqFTP.KeepAlive = false;
- reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
- reqFTP.UseBinary = true;
- reqFTP.ContentLength = fileInf.Length;
- int buffLength = 2048;
- byte[] buff = new byte[buffLength];
- int contentLen;
- using (FileStream fs = fileInf.OpenRead())
- {
- using (Stream strm = reqFTP.GetRequestStream())
- {
- contentLen = fs.Read(buff, 0, buffLength);
- while (contentLen != 0)
- {
- strm.Write(buff, 0, contentLen);
- contentLen = fs.Read(buff, 0, buffLength);
- }
- strm.Close();
- }
- fs.Close();
- }
- }
- //删除服务器上的文件
- private void DeleteWebServerFile(string sFilePath)
- {
- if (File.Exists(sFilePath))
- {
- File.Delete(sFilePath);
- }
- }
- //删除FTP上的文件
- private void DeleteFtpFile(string[] IName, string FolderName, string ftpServerIP, string ftpUserName, string
- ftpPwd)
- {
- foreach (string ImageName in IName)
- {
- string[] FileList = GetFileList(FolderName, ftpServerIP, ftpUserName, ftpPwd);
- for (int i = 0; i < FileList.Length; i++)
- {
- string Name = FileList[i].ToString();
- if (Name == ImageName)
- {
- FtpWebRequest ReqFTP;
- ReqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" +
- FolderName + "/" + ImageName));
- ReqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPwd);
- ReqFTP.KeepAlive = false;
- ReqFTP.Method = WebRequestMethods.Ftp.DeleteFile;
- ReqFTP.UseBinary = true;
- using (FtpWebResponse Response = (FtpWebResponse)ReqFTP.GetResponse())
- {
- long size = Response.ContentLength;
- using (Stream datastream = Response.GetResponseStream())
- {
- using (StreamReader sr = new StreamReader(datastream))
- {
- sr.ReadToEnd();
- sr.Close();
- }
- datastream.Close();
- }
- Response.Close();
- }
- }
- }
- }
- }
- //检查文件是否存在
- public string[] GetFileList(string FolderName, string ftpServerIP, string ftpUserName, string ftpPwd)
- {
- string[] downloadFiles;
- StringBuilder result = new StringBuilder();
- FtpWebRequest reqFTP;
- try
- {
- reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + FolderName +
- "/"));
- reqFTP.UseBinary = true;
- reqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPwd);
- reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
- WebResponse response = reqFTP.GetResponse();
- StreamReader reader = new StreamReader(response.GetResponseStream());
- string line = reader.ReadLine();
- while (line != null)
- {
- result.Append(line);
- result.Append("\n");
- line = reader.ReadLine();
- }
- // to remove the trailing '\n'
- result.Remove(result.ToString().LastIndexOf('\n'), 1);
- reader.Close();
- response.Close();
- return result.ToString().Split('\n');
- }
- catch (Exception ex)
- {
- downloadFiles = null;
- return downloadFiles;
- }
- }
- //从客户端上传文件到FTP上
- private void UploadFtp(HttpPostedFile sFilePath, string filename, string FolderName, string ftpServerIP,
- string ftpUserName, string ftpPwd)
- {
- //获取的服务器路径
- //FileInfo fileInf = new FileInfo(sFilePath);
- FtpWebRequest reqFTP;
- reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + FolderName + "/" +
- filename));
- reqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPwd);
- reqFTP.KeepAlive = false;
- reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
- reqFTP.UseBinary = true;
- reqFTP.ContentLength = sFilePath.ContentLength;
- //设置缓存
- int buffLength = 2048;
- byte[] buff = new byte[buffLength];
- int contentLen;
- using (Stream fs = sFilePath.InputStream)
- {
- using (Stream strm = reqFTP.GetRequestStream())
- {
- contentLen = fs.Read(buff, 0, buffLength);
- while (contentLen != 0)
- {
- strm.Write(buff, 0, contentLen);
- contentLen = fs.Read(buff, 0, buffLength);
- }
- strm.Close();
- }
- fs.Close();
- }
- }
- //创建目录
- private void CreateDirectory(string FolderName, string ftpServerIP, string ftpUserName, string ftpPwd)
- {
- //创建日期目录
- try
- {
- FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" +
- FolderName));
- reqFTP.UseBinary = true;
- reqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPwd);
- reqFTP.KeepAlive = false;
- reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
- FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
- }
- catch
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统忙,请稍后再
- 试!');location.href=location.href;</script>");
- }
- }
- //检查日期目录和文件是否存在
- private static Regex regexName = new Regex(@"[^\s]*$", RegexOptions.Compiled);
- private bool CheckFileOrPath(string FolderName, string ftpServerIP, string ftpUserName, string ftpPwd)
- {
- //检查一下日期目录是否存在
- FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/"));
- reqFTP.UseBinary = true;
- reqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPwd);
- reqFTP.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
- Stream stream = reqFTP.GetResponse().GetResponseStream();
- using (StreamReader sr = new StreamReader(stream))
- {
- string line = sr.ReadLine();
- while (!string.IsNullOrEmpty(line))
- {
- GroupCollection gc = regexName.Match(line).Groups;
- if (gc.Count != 1)
- {
- throw new ApplicationException("FTP 返回的字串格式不正确");
- }
- string path = gc[0].Value;
- if (path == FolderName)
- {
- return true;
- }
- line = sr.ReadLine();
- }
- }
- return false;
- }
- }
通过WebService上传图片
作者:nz.perfectaction 日期:2008-08-15
C#代码
- WebService部分:
- /// <summary>
- /// 保存文件到远程服务器
- /// </summary>
- /// <param name="FileByteArray">待转换字节数组</param>
- /// <param name="FileLength">字节长度</param>
- /// <param name="SaveToUrl">保存路径</param>
- /// <returns>返回是否执行成功</returns>
- [WebMethod(Description = "保存文件到远程服务器.")]
- public bool SaveFile(byte[] FileByteArray,int FileLength, string SaveToUrl)
- {
- try
- {
- FileStream fs = new FileStream(SaveToUrl, FileMode.OpenOrCreate, FileAccess.Write);
- fs.Write(FileByteArray, 0, FileLength);
- fs.Close();
- }
- catch {
- return false;
- }
- return true;
- }
- 调用部分:
- protected void Button1_Click(object sender, EventArgs e)
- {
- MangerPhoto.Service mp = new MangerPhoto.Service();
- Response.Write(mp.SaveFile(getByte(), FileUpload1.PostedFile.ContentLength, "C:\\vv.jpg"));
- }
- private byte[] getByte() {//获得转化后的字节数组
- //得到用户要上传的文件名
- string strFilePathName = FileUpload1.PostedFile.FileName;
- string strFileName = Path.GetFileName(strFilePathName);
- int FileLength = FileUpload1.PostedFile.ContentLength;
- //上传文件
- Byte[] FileByteArray = new Byte[FileLength]; //图象文件临时储存Byte数组
- Stream StreamObject = FileUpload1.PostedFile.InputStream; //建立数据流对像
- //读取图象文件数据,FileByteArray为数据储存体,0为数据指针位置、FileLnegth为数据长度
- StreamObject.Read(FileByteArray, 0, FileLength);
- return FileByteArray;
- }
新劳动法案例:合同期内辞职的补偿金问题
作者:nz.perfectaction 日期:2008-08-14
问:我于2007年12月5日正式上班,在签劳动合同前公司表示,按照2008年新施行的劳动合同法规定,将与我签订新的劳动合同,合同期限为3年,试用期6个月。我想知道,劳动合同签这么久合理吗?如果3年内辞职需要承担违约金呢?另外,合同期内辞职能得到经济补偿金吗?
答:公司如果在2008年1月底之前不与张先生签订《劳动合同》是违法的,公司就应该支付双倍的工资,而且签订劳动合同时应告知张先生相关的权利和义务。
合同期限3年是合理的,试用期6个月也是合法的。《劳动合同法》的颁布就是要求企业与员工签订劳动合同,而且希望企业与员工多签中长期劳动合同,这些规定就是为使我们国家的劳动用工规范化、合理化。
如果想在合同期内辞职,按照法律规定不会承担违约金,但是应该提前1个月向公司提出辞职申请,并办理《离职交接》。
如果在合同期内提出辞职,按照法律规定将不会得到经济补偿金。根据《劳动合同法》的规定:由劳动者提出解除劳动合同的,用人单位有权不支付经济补偿金。
答:公司如果在2008年1月底之前不与张先生签订《劳动合同》是违法的,公司就应该支付双倍的工资,而且签订劳动合同时应告知张先生相关的权利和义务。
合同期限3年是合理的,试用期6个月也是合法的。《劳动合同法》的颁布就是要求企业与员工签订劳动合同,而且希望企业与员工多签中长期劳动合同,这些规定就是为使我们国家的劳动用工规范化、合理化。
如果想在合同期内辞职,按照法律规定不会承担违约金,但是应该提前1个月向公司提出辞职申请,并办理《离职交接》。
如果在合同期内提出辞职,按照法律规定将不会得到经济补偿金。根据《劳动合同法》的规定:由劳动者提出解除劳动合同的,用人单位有权不支付经济补偿金。
ASP.NET Impersonation
作者:nz.perfectaction 日期:2008-08-13
解决上传到局域网其它电脑文件权限问题:
http://msdn.microsoft.com/en-us/library/aa292118.aspx
<identity impersonate="true"
userName="domain\user"
password="password" /&...
http://msdn.microsoft.com/en-us/library/aa292118.aspx
<identity impersonate="true"
userName="domain\user"
password="password" /&...
JS取屏幕信息
作者:nz.perfectaction 日期:2008-08-04
JavaScript代码
- <script language="javascript">
- function screenInfo(){
- var s = "";
- s += "\r\n网页可见区域宽:"+ document.body.clientWidth;
- s += "\r\n网页可见区域高:"+ document.body.clientHeight;
- s += "\r\n网页可见区域宽:"+ document.body.offsetWidth +" (包括边线的宽)";
- s += "\r\n网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
- s += "\r\n网页正文全文宽:"+ document.body.scrollWidth;
- s += "\r\n网页正文全文高:"+ document.body.scrollHeight;
- s += "\r\n网页被卷去的高:"+ document.body.scrollTop;
- s += "\r\n网页被卷去的左:"+ document.body.scrollLeft;
- s += "\r\n网页正文部分上:"+ window.screenTop;
- s += "\r\n网页正文部分左:"+ window.screenLeft;
- s += "\r\n屏幕分辨率的高:"+ window.screen.height;
- s += "\r\n屏幕分辨率的宽:"+ window.screen.width;
- s += "\r\n屏幕可用工作区高度:"+ window.screen.availHeight;
- s += "\r\n屏幕可用工作区宽度:"+ window.screen.availWidth;
- alert(s);
- }
- screenInfo();
- </script>
- 注:我试过,如果在网页的前面有如下的W3C标准的头,上面的document.body.clientHeight和document.body.scrollTop是无效的
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
行列互转总结
作者:nz.perfectaction 日期:2008-08-01
SQL代码
- --行列互转
- /******************************************************************************************************************************************************
- 以学生成绩为例子,比较形象易懂
- 整理人:中国风(Roy)
- 日期:2008.06.06
- ******************************************************************************************************************************************************/
- --1、行互列
- --> --> (Roy)生成測試數據
- if not object_id('Class') is null
- drop table Class
- Go
- Create table Class([Student] nvarchar(2),[Course] nvarchar(2),[Score] int)
- Insert Class
- select N'张三',N'语文',78 union all
- select N'张三',N'数学',87 union all
- select N'张三',N'英语',82 union all
- select N'张三',N'物理',90 union all
- select N'李四',N'语文',65 union all
- select N'李四',N'数学',77 union all
- select N'李四',N'英语',65 union all
- select N'李四',N'物理',85
- Go
- --2000方法:
- 动态:
- declare @s nvarchar(4000)
- set @s=''
- Select @s=@s+','+quotename([Course])+'=max(case when [Course]='+quotename([Course],'''')+' then [Score] else 0 end)'
- from Class group by[Course]
- exec('select [Student]'+@s+' from Class group by [Student]')
- 生成静态:
- select
- [Student],
- [数学]=max(case when [Course]='数学' then [Score] else 0 end),
- [物理]=max(case when [Course]='物理' then [Score] else 0 end),
- [英语]=max(case when [Course]='英语' then [Score] else 0 end),
- [语文]=max(case when [Course]='语文' then [Score] else 0 end)
- from
- Class
- group by [Student]
- GO
- 动态:
- declare @s nvarchar(4000)
- Select @s=isnull(@s+',','')+quotename([Course]) from Class group by[Course]
- exec('select * from Class pivot (max([Score]) for [Course] in('+@s+'))b')
- 生成静态:
- select *
- from
- Class
- pivot
- (max([Score]) for [Course] in([数学],[物理],[英语],[语文]))b
- 生成格式:
- /*
- Student 数学 物理 英语 语文
- ------- ----------- ----------- ----------- -----------
- 李四 77 85 65 65
- 张三 87 90 82 78
- (2 行受影响)
- */
- ------------------------------------------------------------------------------------------
- go
- --加上总成绩(学科平均分)
- --2000方法:
- 动态:
- declare @s nvarchar(4000)
- set @s=''
- Select @s=@s+','+quotename([Course])+'=max(case when [Course]='+quotename([Course],'''')+' then [Score] else 0 end)'
- from Class group by[Course]
- exec('select [Student]'+@s+',[总成绩]=sum([Score]) from Class group by [Student]')--加多一列(学科平均分用avg([Score]))
- 生成动态:
- select
- [Student],
- [数学]=max(case when [Course]='数学' then [Score] else 0 end),
- [物理]=max(case when [Course]='物理' then [Score] else 0 end),
- [英语]=max(case when [Course]='英语' then [Score] else 0 end),
- [语文]=max(case when [Course]='语文' then [Score] else 0 end),
- [总成绩]=sum([Score]) --加多一列(学科平均分用avg([Score]))
- from
- Class
- group by [Student]
- go
- --2005方法:
- 动态:
- declare @s nvarchar(4000)
- Select @s=isnull(@s+',','')+quotename([Course]) from Class group by[Course] --isnull(@s+',','') 去掉字符串@s中第一个逗号
- exec('select [Student],'+@s+',[总成绩] from (select *,[总成绩]=sum([Score])over(partition by [Student]) from Class) a
- pivot (max([Score]) for [Course] in('+@s+'))b ')
- 生成静态:
- select
- [Student],[数学],[物理],[英语],[语文],[总成绩]
- from
- (select *,[总成绩]=sum([Score])over(partition by [Student]) from Class) a --平均分时用avg([Score])
- pivot
- (max([Score]) for [Course] in([数学],[物理],[英语],[语文]))b
- 生成格式:
- /*
- Student 数学 物理 英语 语文 总成绩
- ------- ----------- ----------- ----------- ----------- -----------
- 李四 77 85 65 65 292
- 张三 87 90 82 78 337
- (2 行受影响)
- */
- go
- --2、列转行
- --> --> (Roy)生成測試數據
- if not object_id('Class') is null
- drop table Class
- Go
- Create table Class([Student] nvarchar(2),[数学] int,[物理] int,[英语] int,[语文] int)
- Insert Class
- select N'李四',77,85,65,65 union all
- select N'张三',87,90,82,78
- Go
- --2000:
- 动态:
- declare @s nvarchar(4000)
- select @s=isnull(@s+' union all ','')+'select [Student],[Course]='+quotename(Name,'''')--isnull(@s+' union all ','') 去掉字符串@s中第一个union all
- +',[Score]='+quotename(Name)+' from Class'
- from syscolumns where ID=object_id('Class') and Name not in('Student')--排除不转换的列
- order by Colid
- exec('select * from ('+@s+')t order by [Student],[Course]')--增加一个排序
- 生成静态:
- select *
- from (select [Student],[Course]='数学',[Score]=[数学] from Class union all
- select [Student],[Course]='物理',[Score]=[物理] from Class union all
- select [Student],[Course]='英语',[Score]=[英语] from Class union all
- select [Student],[Course]='语文',[Score]=[语文] from Class)t
- order by [Student],[Course]
- go
- --2005:
- 动态:
- declare @s nvarchar(4000)
- select @s=isnull(@s+',','')+quotename(Name)
- from syscolumns where ID=object_id('Class') and Name not in('Student')
- order by Colid
- exec('select Student,[Course],[Score] from Class unpivot ([Score] for [Course] in('+@s+'))b')
- go
- select
- Student,[Course],[Score]
- from
- Class
- unpivot
- ([Score] for [Course] in([数学],[物理],[英语],[语文]))b
- 生成格式:
- /*
- Student Course Score
- ------- ------- -----------
- 李四 数学 77
- 李四 物理 85
- 李四 英语 65
- 李四 语文 65
- 张三 数学 87
- 张三 物理 90
- 张三 英语 82
- 张三 语文 78
- (8 行受影响)
- */
Tags: 行转列






