declare @targetdate datetime,
@targetdate_lastmonth1 datetime,
@targetdate_lastmonth2 datetime

select @targetdate = getdate()

select @targetdate_lastmonth1 = dateadd(month,1,dateadd(m,-1,@targetdate) )-(day(@targetdate))

select @targetdate_lastmonth2 = dateadd(month,1,dateadd(m,-2,@targetdate) )-(day(@targetdate))

select @targetdate, @targetdate_lastmonth1, @targetdate_lastmonth2
Posted by 아로스

selectbox

Windows/jquery 2010. 10. 11. 16:14

jQuery로 선택된 값 읽기
$("#select_box option:selected").val();
$("select[name=name]").val();

jQuery로 선택된 내용 읽기
$("#select_box option:selected").text();

선택된 위치
var index = $("#test option").index($("#test option:selected"));

-------------------------------------------------------------------

// Add options to the end of a select
$("#myselect").append("<option value='1'>Apples</option>");
$("#myselect").append("<option value='2'>After Apples</option>");

// Add options to the start of a select
$("#myselect").prepend("<option value='0'>Before Apples</option>");

// Replace all the options with new options
$("#myselect").html("<option value='1'>Some oranges</option><option value='2'>More Oranges</option><option value='3'>Even more oranges</option>");

// Replace items at a certain index
$("#myselect option:eq(1)").replaceWith("<option value='2'>Some apples</option>");
$("#myselect option:eq(2)").replaceWith("<option value='3'>Some bananas</option>");

// Set the element at index 2 to be selected
$("#myselect option:eq(2)").attr("selected", "selected");

// Set the selected element by text
$("#myselect").val("Some oranges").attr("selected", "selected");

// Set the selected element by value
$("#myselect").val("2");

// Remove an item at a particular index
$("#myselect option:eq(0)").remove();

// Remove first item
$("#myselect option:first").remove();

// Remove last item
$("#myselect option:last").remove();

// Get the text of the selected item
alert($("#myselect option:selected").text());

// Get the value of the selected item
alert($("#myselect option:selected").val());

// Get the index of the selected item
alert($("#myselect option").index($("#myselect option:selected")));

// Alternative way to get the selected item
alert($("#myselect option:selected").prevAll().size());

// Insert an item in after a particular position
$("#myselect option:eq(0)").after("<option value='4'>Some pears</option>");

// Insert an item in before a particular position
$("#myselect option:eq(3)").before("<option value='5'>Some apricots</option>");

// Getting values when item is selected
$("#myselect").change(function() {
alert($(this).val());
alert($(this).children("option:selected").text());
});
Posted by 아로스

설명: 현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 발생했습니다. 스택 추적을 검토하여 발생한 오류 및 코드에서 오류가 발생한 위치에 대한 자세한 정보를 확인하십시오.


예외 정보: System.Web.HttpException: viewstate MAC에 대한 유효성 검사가 실패했습니다. 웹 팜 또는 클러스터에서 이 응용 프로그램을 호스팅하는 경우에는 <machineKey> 구성에 동일한 validationKey와 유효성 검사 알고리즘을 지정해야 합니다. 클러스터에서는 AutoGenerate를 사용할 수 없습니다.


간혹 ASP.NET을 서비스 할 때 이런 에러가 발생한다. 이유는 L4스위치나 NLB로 웹서버 웹팜 구성시 사용자가 웹서버들을 이동할 시 세션정보들이 어긋나서 생긴다고 한다.


결국 서버들이 같은 넘인걸로 인식하도록 해야한다는 얘기


해결 방법


L4 로 묶인 서버들에

OS가 설치된 드라이브 \WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG 에 있는

machine.config 에 <system.web> 항목에 <machineKey validationKey='키 값' validation='SHA1'/>

를 설정해준다.


또는, web.config 에 다음과 같은 구문을 추가한다. <pages enableViewStateMac="false"/>

Posted by 아로스

<img id="imImg" src="1.gif">

$("#imImg").attr("src","2.gif");

$("#imImg").bind("click",function(){
 $("#imImg").attr("src","3.gif");
 });

$("img".bind("click",function(){
 var src=($(this).attr("src") == "3.gif")
  ? "1_on.gif"
  : "1_on.gif";
 $(this).attr("src",src);
});

Posted by 아로스

DOS 컴파일

Windows/c# 2010. 7. 7. 11:50

csc [파일명]


exe 만들기
>csc [파일명].cs

dll 만들기
> csc /t:library [파일명].cs

dll 포함 컴파일
> csc /r:[파일명].dll [파일명].cs

Posted by 아로스

아로스

달력