项目过程中一些收获

  没有高深的东西,仅仅是小知识、小应用。都是项目开发过程中记录下来的,大都来源于网上。整理下让自己看着方便,也分享下,希望能有点帮助。

  一、获取web根地址 ,因为有些创建的是虚拟目录,有些创建的站点

         public   static   string  WebsiteRoot()
        {
            HttpRequest request
= HttpContext.Current.Request;
            
string  root  =  request.Url.GetLeftPart(UriPartial.Authority); 
            
if  (request.ApplicationPath  ==   null   ||  request.ApplicationPath  ==   " / " )
            {
                
// 安装在web站点
                 return  root;
            }
            
// 安装在虚拟目录
             return   string .Concat(root, request.ApplicationPath);            
        }

 

  二、JS判定IE是否已经关闭

        window.onunload  =   function () {
            
var  clientX  =  event.clientX;
            
if  (clientX  <   0   ||  clientX  >   3000 ) {
                
/* 用户关闭了IE.
                 *已经在IE6,7下测试过两种关闭方式:
                 *1.点击关闭按键   2.ALT+F4
                
*/

                
// 需要执行的代码
                alert( " 已经关闭 " );
            }
        }

 

  三、日志记录

  可以使用NLog做为日志工具,对其进行简单封装就OK了

 

  四、EXCEL导出

  可以使用CarlosAg.ExcelXmlWriter,包括代码自动生成工具

  

  五、XML编辑工具

  Altova XMLSpy,   破解版下载地址:http://www.verycd.com/topics/2838119/

    Altova MapForce ,破解版文件太大,无法上传,地址忘记了

   

    六、jQuery

  JS中的匿名函数又称为闭包函数 例子:(function(arg){})("1"); jQuery扩展可以这样书写 (function($){ ... })(jQuery);  

var  jQuery  =  window.jQuery  =  window.$  =   function (selector, context)  {  
   
//  ...  // other internal initialization code goes here 

}; 
// 可以将jQuery理解为类 

jQuery.fn 
=  jQuery.prototype

jQuery.func1
= function (){

     ..... 

}  
// 可以将其理解为jQuery静态函数

jQuery.fn.func2
= function (){

      ..... 

}  
// 可以将其理解为jQuery实例函数


  七、Oracle

  字符填充:可以使用函数lpad rpad,具体功能指若字符串长度小于指定长度,则用指定的字符进行补全,可以在网上搜索下

    将十进制转化为二进制函数 :   

 

  create   or   replace   function  ufun_tentobin(ix  in   number return   varchar2   is

  vars 
varchar2 ( 1000 );

  xs   
number ( 10 );

begin

  
if  ix <= 0   then

  
begin

     
return   ' 0 ' ;

  
end ;

  
end   if ;

  vars :
=   '' ;

  xs   :
=  ix;

  
while  xs  >   0  loop

    vars :
=   cast (mod(xs,  2 as   varchar2 ||  vars;

    xs   :
=   floor (xs  /   2 );

  
end  loop;

  
return  vars;

end ;


  使用查询语句将二进制转化为十进制:

select   sum (data1) 
from  ( select  substr(二进制字符串, rownum,  1 *   power ( 2 , length(二进制字符串)  -  rownum) data1
from  dual
connect 
by  rownum  <=  length(二进制字符串)); 

  

  八、jquery easyui

  datagrid控件使用Post获取.json文件需要进行一些设置,可以看看这篇文章

  http://blog.csdn.net/zhhhhao/archive/2009/04/06/4051352.aspx

  jQuery中ajax的提交方式post、get,在服务端获取查询参数的方式不同:

         public   static  System.Collections.Specialized.NameValueCollection QueryParams(HttpContext context)
        {
            HttpRequest request 
=  context.Request;
            
if  (request.RequestType  ==   " GET " )
            {
                
return  request.QueryString;
            }
            
return  request.Form;
        }


 

  

  

 


 

 

  

  

 

 

转载于:https://www.cnblogs.com/WGZ_Home/archive/2010/10/19/1855852.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值