asp.Net

Dot Net

博客园 首页 新随笔 联系 订阅 管理
  4 Posts :: 0 Stories :: 0 Comments :: 0 Trackbacks

2008年9月16日 #

using System;
using System.Data;
using System.Configuration;
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;
using System.Text;


namespace EC
{
    /// <summary>
    /// 随机函数
    /// </summary>
    public class RandomObject
    {

        #region 数字随机数
        /// <summary>
        /// 数字随机数
        /// </summary>
        /// <param name="n">生成长度</param>
        /// <returns></returns>
        public static string RandNum(int n)
        {
            char[] arrChar = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
            StringBuilder num = new StringBuilder();

            Random rnd = new Random(DateTime.Now.Millisecond);

            for (int i = 0; i < n; i++)
            {
                num.Append(arrChar[rnd.Next(0, 9)].ToString());

            }

            return num.ToString();
        }
        #endregion

        #region 数字和字母随机数
        /// <summary>
        /// 数字和字母随机数
        /// </summary>
        /// <param name="n">生成长度</param>
        /// <returns></returns>
        public static string RandCode(int n)
        {
            char[] arrChar = new char[]{
           'a','b','d','c','e','f','g','h','i','j','k','l','m','n','p','r','q','s','t','u','v','w','z','y','x',
           '0','1','2','3','4','5','6','7','8','9',
           'A','B','C','D','E','F','G','H','I','J','K','L','M','N','Q','P','R','T','S','V','U','W','X','Y','Z'
          };

            StringBuilder num = new StringBuilder();

            Random rnd = new Random(DateTime.Now.Millisecond);
            for (int i = 0; i < n; i++)
            {
                num.Append(arrChar[rnd.Next(0, arrChar.Length)].ToString());

            }

            return num.ToString();
        }
        #endregion

        #region 字母随机数
        /// <summary>
        /// 字母随机数
        /// </summary>
        /// <param name="n">生成长度</param>
        /// <returns></returns>
        public static string RandLetter(int n)
        {
            char[] arrChar = new char[]{
            'a','b','d','c','e','f','g','h','i','j','k','l','m','n','p','r','q','s','t','u','v','w','z','y','x',
            '_',
           'A','B','C','D','E','F','G','H','I','J','K','L','M','N','Q','P','R','T','S','V','U','W','X','Y','Z'
          };

            StringBuilder num = new StringBuilder();

            Random rnd = new Random(DateTime.Now.Millisecond);
            for (int i = 0; i < n; i++)
            {
                num.Append(arrChar[rnd.Next(0, arrChar.Length)].ToString());

            }

            return num.ToString();
        }
        #endregion

        #region 日期随机函数
        /// <summary>
        /// 日期随机函数
        /// </summary>
        /// <param name="ra">长度</param>
        /// <returns></returns>
        public static string DateRndName(Random ra)
        {
            DateTime d = DateTime.Now;
            string s = null, y, m, dd, h, mm, ss;
            y = d.Year.ToString();
            m = d.Month.ToString();
            if (m.Length < 2) m = "0" + m;
            dd = d.Day.ToString();
            if (dd.Length < 2) dd = "0" + dd;
            h = d.Hour.ToString();
            if (h.Length < 2) h = "0" + h;
            mm = d.Minute.ToString();
            if (mm.Length < 2) mm = "0" + mm;
            ss = d.Second.ToString();
            if (ss.Length < 2) ss = "0" + ss;
            s += y + m + dd + h + mm + ss;
            s += ra.Next(100, 999).ToString();
            return s;
        }
        #endregion

        #region 生成GUID
        /// <summary>
        /// 生成GUID
        /// </summary>
        /// <returns></returns>
        public static string GetGuid()
        {
            System.Guid g = System.Guid.NewGuid();
            return g.ToString();
        }
        #endregion
    }
}

posted @ 2008-09-16 15:33 天山来宾 阅读(53) 评论(0) 编辑

2008年9月12日 #

<body><SCRIPT   LANGUAGE="JavaScript">...  
  var     s   =   "";  
  s   +=   " 网页可见区域宽:"+   document.body.clientWidth;  
  s   +=   " 网页可见区域高:"+   document.body.clientHeight;  
  s   +=   " 网页可见区域宽:"+   document.body.offsetWidth     +"   (包括边线和滚动条的宽)";  
  s   +=   " 网页可见区域高:"+   document.body.offsetHeight   +"   (包括边线的宽)";  
  s   +=   " 网页正文全文宽:"+   document.body.scrollWidth;  
  s   +=   " 网页正文全文高:"+   document.body.scrollHeight;  
  s   +=   " 网页被卷去的高:"+   document.body.scrollTop;  
  s   +=   " 网页被卷去的左:"+   document.body.scrollLeft;  
  s   +=   " 网页正文部分上:"+   window.screenTop;  
  s   +=   " 网页正文部分左:"+   window.screenLeft;  
  s   +=   " 屏幕分辨率的高:"+   window.screen.height;  
  s   +=   " 屏幕分辨率的宽:"+   window.screen.width;  
  s   +=   " 屏幕可用工作区高度:"+   window.screen.availHeight;  
  s   +=   " 屏幕可用工作区宽度:"+   window.screen.availWidth;  
  s   +=   " 你的屏幕设置是   "+   window.screen.colorDepth   +"   位彩色";  
  s   +=   " 你的屏幕设置   "+   window.screen.deviceXDPI   +"   像素/英寸";  
  alert(s);  
  </SCRIPT>
posted @ 2008-09-12 16:42 天山来宾 阅读(338) 评论(0) 编辑

2008年6月13日 #

<html>
<head>
<title>www.bx115.com</title>
<style type="text/css">
 body {cursor:crosshair; background:#111; margin:0; padding:0; position:absolute; overflow:hidden; left:0; top:0; width:100%; height:100%;}
 .link {position:absolute;left:0;width:100%;height:0;background:#000;overflow:hidden;visibility:hidden;}
 .title   {position:relative;cursor:pointer;background:#333;width:100%;color:#fff;font-family:verdana;font-size:11px;left:2;height:15;overflow:hidden;}
 .title_o {position:relative;cursor:pointer;background:#fff;width:100%;color:#000;font-family:verdana;font-size:11px;left:2;height:15;overflow:hidden;}
 .text {position:relative;text-align:justify;margin:10px;font-family:verdana;font-size:11px;color:#FFF;overflow:hidden;height:90%}

</style>

<script type="text/javascript"><!--
var object = new Array();

function Slide(N,oCont){
 this.N  = N;
 this.S  = 1.1;
 this.object = new Array();

 this.CObj = function (parent,N){
 
  this.parent = parent;
  this.N = N;
  this.obj = parent.frm[N];
  this.tit = this.obj.firstChild;
  this.div = this.obj.getElementsByTagName("div")[1];
  this.div.style.visibility = "hidden";
  this.y0 = N * 18;
  this.Y1 = this.y0;
  this.obj.style.top = this.y0;
  this.obj.style.height = parent.H - (parent.NF-1) * 18 - 3;
  this.obj.style.visibility = "visible";
  this.obj.parent = this;
  this.run = false;
  
  this.move = function(){
   with(this){
    dy = (y1-y0)/parent.S;
    if(Math.abs(dy)>.1){
     y0+=dy;
     obj.style.top = Math.round(y0);
     setTimeout("object["+parent.N+"].object["+N+"].move();", 16);
    } else {
     run = false;
     if(dy>0)div.style.visibility="hidden";
     else if(N>0)parent.object[N-1].div.style.visibility="hidden";
    }
   }
  }
  
  this.obj.onmouseover = function(){
   with(this.parent){
    if(!run){
     run = true;
     div.style.visibility="visible";
     for(i=0;i<parent.NF;i++)parent.object[i].tit.className = "title";
     tit.className = "title_o";
     for(i=0;i<=N;i++){
      parent.object[i].y1 = i*18;
      parent.object[i].move();
     }
     for(i=N+1;i<parent.NF;i++){
      parent.object[i].y1 = parent.H-(parent.NF-i)*18;
      parent.object[i].move();
     }
    }
   }
  }
 }

 this.frm = document.getElementById(oCont);
 this.H = parseInt(this.frm.style.height);
 this.frm = this.frm.getElementsByTagName("span");
 this.NF = this.frm.length;
 for(i=0;i<this.NF;i++) this.object[i] = new this.CObj(this, i);
 this.object[0].obj.onmouseover();
 this.S = 10;
}

onload = function() {
 object[0] = new Slide(0, "frames");
}

//-->
</script></head><body>

<div style="position: absolute; left: 50%; top: 50%;">
 <div id="frames" style="overflow: hidden; position: absolute; width: 200px; height: 340px; left: -100px; top: -170px;">
  <span style="top: 0pt; height: 211px; visibility: visible;" class="link"><div class="title_o"></div>
   <div style="margin: 20px; overflow: hidden; position: relative; text-align: center; font-family: verdana; font-size: 32px; font-weight: bold; color: rgb(255, 255, 255); height: 90%; visibility: visible;">
     The Circle of Life
   </div>
  </span>
  <span style="top: 213px; height: 211px; visibility: visible;" class="link"><div class="title">Programmer to Module Leader:</div>
   <div style="visibility: hidden;" class="text">
"This is not possible. **Impossible**. It will involve design change
and no body in our team knows the design of the system. And above that
nobody in our company knows the language in which this software has
been written. So even if somebody wants to work on it, they can't. If
you ask my personal opinion the company should never take these type of
projects." </div>
  </span>
  <span style="top: 231px; height: 211px; visibility: visible;" class="link"><div class="title">Module Leader to Project Manager:</div>
   <div style="visibility: hidden;" class="text">
"This project will involve design change. Currently we don't have
people who have experience in this type of work. Also the language is
unknown so we will have to arrange for some training if we take this
project. In my personal opinion, we should avoid taking this project." </div>
  </span>
  <span style="top: 249px; height: 211px; visibility: visible;" class="link"><div class="title">Project Manager to 1st Level Manager:</div>
   <div style="visibility: hidden;" class="text">
"This project involves design change in the system and we don't have
much experience in that area. Also not many people are trained in this
area. In my personal opinion we can take the project but we should ask
for some more time." </div>
  </span>
  <span style="top: 267px; height: 211px; visibility: visible;" class="link"><div class="title">1st Level Manager to 2nd Level Manager:</div>
   <div style="visibility: hidden;" class="text">
"This project involves design re-engineering. We have some people who
have worked in this area and some who know the language. So they can
train other people. In my personal opinion we should take this project
but with caution." </div>
  </span>
  <span style="top: 285px; height: 211px; visibility: visible;" class="link"><div class="title">2nd Level Manager to CEO:</div>
   <div style="visibility: hidden;" class="text">
"This project will show the industry our capabilities in remodeling the
design of a complete system. We have all the necessary skills and
people to execute this project successfully. Some people have already
given in-house training in this area to other people. In my personal
opinion we should not let this project go by under any circumstance." </div>
  </span>
  <span style="top: 303px; height: 211px; visibility: visible;" class="link"><div class="title">CEO to Client:</div>
   <div style="visibility: hidden;" class="text">
"These are the type of projects in which our company specialize. We
have executed many project of the same nature for many big clients.
Trust me when I say that you are in the safest hand in the Industry. In
my personal opinion we can execute this project successfully and that
too well with in the given time frame." </div>
  </span>
  <span style="top: 321px; height: 211px; visibility: visible;" class="link"><div class="title"></div>
   <div style="margin: 20px; overflow: hidden; position: relative; text-align: center; font-family: verdana; font-size: 32px; font-weight: bold; color: rgb(255, 255, 255); height: 90%; visibility: hidden;">
     The End
   </div>
  </span>
 </div>
</div>
</body></html>

posted @ 2008-06-13 09:05 天山来宾 阅读(718) 评论(0) 编辑

use master
go

declare @name varchar(50)
declare cur_name cursor for
select top 10 [name] from sysobjects --定义游标
open cur_name --打开游标
fetch next from cur_name into @name --将name字段存到@name变量中
while @@fetch_status=0 --执行成功
begin
print @name --打印
fetch next from cur_name into @name
end
close cur_name --关闭游标
deallocate cur_name --销毁游标

posted @ 2008-06-13 08:58 天山来宾 阅读(105) 评论(0) 编辑