2013年9月4日 星期三

mssql general command

W3Schools.com


DBCC (Transact-SQL)

Overview of SQL Query Analyzer


mssql-general-command

Remark : --

Use working Database :  use DataBaseName
List out tables : select * from information_schema.tables;
Data Structure : select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='tablenName'

SP_SPACEUSED  -- can get (name rows reserved data index_size unused)

EXEC SP_SPACEUSED   -- find the size of ms sql server database
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"   --  size of all tables from database

select len('Adeel Fakhar') as length;   -- output 12
select len('Adeel Fakhar''s passion is programming') as length;  -- output 37

select * from [database_server_name].[database_name].dbo.tbl_name -- Query to get data from another database server

jquery-modal

http://psdreview.com/35-best-jquery-popup-window-dialog-boxes/


jquery-listener


jquery listener


$("#submit1").click(function(){$("#testForm").submit();});

$(function () {
       $('#popup-wrapper').modalPopLite({ openButton: '#clicker', closeButton: '#close-btn',       isModal: true });
       $( "p" ).click(function() { $( this ).slideUp();});
       $( "#target" ).click(function() { alert( "Handler for .click() called." );});
});


$('.expandable').mouseenter(function () { $(".divname").css('visibility', 'hidden'); $(".divname").fadeIn('fast', function () { $(this).css('visibility', 'visible'); alert("The paragraph is now visible"); }); }





$("button").click(function(){
  $("p").hide("slow",function(){
    alert("The paragraph is now hidden");
  });
});



$( "#password" ).blur(function() {
s0=_lookup('username');
s1=_lookup('password');
s='tableRead?db=hr&table=USER&fields=COMPANY_NAME&where=where '+
'login_id:`'+s0+'` and password:sha(`'+s1+'`) &format=S&callback=?';
$.getJSON(s,
 function(data) {
 if (data[0]){
$("#companyname").removeAttr("disabled");
$('#companyname').find('option').remove().end();
for (r=0; r<data.length; r++){
var o = new Option(data[r][0],data[r][0] );
$(o).html(data[r][0]);
$("#companyname").append(o);
}
  }  else {
$('#companyname').find('option').remove().end().append('<option value=""></option>').val('');
$("#companyname").attr( "disabled", "disabled" );
  }
 }
);
});






domc document.createElement

http://www.w3school.com.cn/xmldom/met_document_createelement.asp



var newText = document.createElement('input');
newText.style.cssText = 'display:block;width:<%=iWidth%><%=Input[i][26]%>;'; //20130821
newText.name = '<%=tableField%>[' + thisRow+']';
newText.id = '<%=tableField%>' + thisRow;
newText.type='<%=siType[0]%>';
if ('<%=tableField%>'=='<%=dbfName%>.Datetimer'){newText.value=milliseconds = new Date().getTime();}  //generate datetimer
newText.onkeypress=function (event){};
newText.onclick = function(event) {};
newText.className="gridDblClick"; //20130904
newText.ondblclick = function(event){
$('#abc_frame').prop('src', 'input.jsp?input=employeeInput.txt&config=employeeInputConfig.txt&key=emploeeid&keyValue='+Xdata[thisRowNo]);
$('#clicker').click();
//window.open('input.jsp?input=employeeInput.txt&config=employeeInputConfig.txt&key=emploeeid&keyValue='+Xdata[thisRowNo], '_self');
//messagebox('#employeeEdit',900,600,'Send');
//http://192.168.10.80:8080/hr/input.jsp?input=employeeInput.txt&config=employeeInputConfig.txt&key=emploeeid&keyValue=7
//alert(Xdata[thisRowNo]);
//openNewWindow("input.jsp?input=employeeInput.txt&config=employeeInputConfig.txt&key=emploeeid&keyValue="+Xdata[thisRowNo],200,300);
};//2013083017 20130902 working
newText.onfocus = function(event) {SelectAll(this.id);
thisID='<%=tableField%>' + thisRow;
thisDBFName="<%=dbfName%>";
nextField='<%=nextField%>' + thisRow;
enterField='<%=nextField%>' + thisRow;
prevField='<%=PreviouField%>' + thisRow;
upperField='<%=tableField%>' + ((thisRow*1)-1);
lowerField='<%=tableField%>' +((thisRow*1)+1) ;
thisTable="tableName<%=sID%>";
thisRowNo=this.parentNode.parentNode.rowIndex;
gRowNo=thisRowNo;
sayRecno(thisRowNo);
highlightGridRow("tableName<%=sID%>");
//setGridBackgroundColor("C", this,this.id,this.parentNode.parentNode.rowIndex,thisTable,"");
};
//newText.onclick = function(event) {SelectAll(this.id); sayRecno(this.parentNode.parentNode.rowIndex);};
<%if (MODE.equals("LIST")){%>newText.setAttribute("readOnly","true"); //20130904  <%}%>

html-size , javascript-window

html-window-size


            $(window).resize(function () {
                if (isOpen) {
                    var winW = $(window).width();
                    var winH = $(window).height();
                    var objW = $('.modalPopLite-child-' + thisPopID).outerWidth();
                    var objH = $('.modalPopLite-child-' + thisPopID).outerHeight();
                    var left = (winW / 2) - (objW / 2);
                    var top = (winH / 2) - (objH / 2);
                    $('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top });
                }
            });


window.onbeforeunload = function() {
    return 'You have unsaved changes!';
}

html file-event


example  :

iframe fire the parent function()
<button class="SaveButton" type="button" onclick="parent.hello();">Close</button>


function fire the object-event

function hello(string){
//alert('hellox');
$('#close-btn').click();
}


window.location = $('#myanchor').attr('href');

window.open($('#myanchor').attr('href'));




2013年9月3日 星期二

html-iframe-fire-parent scroll y only




a record click to change iFrame 

<p>Click on link bellow to change iframe content:</p>
<a href="http://www.bing.com" target="search_iframe">Bing</a> -
<a href="http://en.wikipedia.net" target="search_iframe">Wikipedia</a> -
<a href="http://google.com" target="search_iframe">Google</a> (not allowed in inframe)

<iframe src="http://en.wikipedia.net" width="100%" height="100%" name="search_iframe"></iframe>
*
iframe-scroll-y only


iframe{ width:500px; height: 500px; overflow-x: hidden; overflow-y: scroll }
<iframe  scrolling="no" height="400" width="600" >
<div id="addcontent" style='width:600px;overflow-y:scroll;overflow-x:hidden;height:400px;position:relative;top:0px;left:0px;'>
</div>
</iframe>


iframe-call-parent-event
sub-form-call-parent-form

inf : http://www.roseindia.net/java/pass-value-example/pass-value-from-iframe-parent.shtml


<~!--inputForm.html--(sub form)>
<html>
<head>
<title>IFrame Example</title>
</head>
<body>
<form name="frm2" >
<h1><font color="#000099">Input Form</font></h1>
<p>Name : </p><input type="text" name="resp" id="input" value=""/>
<input type="button" onclick="parent.hello(this.form.resp.value);" value="Submit" />
</form>
</body>


<!--PassValueIFrame.html--(main form)>
<html>
 <head>
  <title>IFrame Example</title>
  <script language="javascript">
function hello(string){
var name=string
document.getElementById('myAnchor').value=name;
}
 </script>
</head>
 <body>
  <iframe namne="iframe" id="iframe_id" src="inputForm.html" height="150" >
</iframe>
Name: <input type="text"  id="myAnchor" >
 </body>
</html>