2020. 1. 16. 09:44

[Coldfusion] GET, POST 원시데이타 처리 getPageContext().getRequest()

requestObj = getPageContext().getRequest();
writeDump(requestObj.getParameter('a')); //일반 변수 시 사용, a 변수에 대한 처음 한개의 값을 가져옴
writeDump(requestObj.getParameterValues('a')); //같은 변수명의 값이 여러개인 경우 사용, a 변수에 대한 모든 값을 가져옴(배열)
writeDump(requestObj.getParameterMap()); //전체 수신 data를 struct로 가져옴.
writeDump(requestObj);

//getParameterMap()의 struct는 data.key 형태로 사용이 되지 않는다. 반드시 data['key']로 사용해야 하고.
//각 key에 들어있는 array는 cf11용 메소드 방식이 사용되지 않는다 ㅡㅡ;
//data['key'].len() -> 오류발생, arraylen(data['key']) 형태로 써야한다.


참고 : https://wyseburn.tistory.com/entry/Coldfusion-%EA%B0%99%EC%9D%80-%EC%9D%B4%EB%A6%84%EC%9D%98-form-element-%EC%B2%98%EB%A6%AC-%EB%B0%A9%EB%B2%95

참고 : https://wyseburn.tistory.com/entry/%EC%BD%9C%EB%93%9C%ED%93%A8%EC%A0%84Coldfusion-%EB%A9%94%EB%AA%A8

2020. 1. 9. 10:14

[jQueryUI Tab] Page Refresh 후에도 Tab이 변하지 않는 방법

var currentTab = window.location.hash.substring(1);
var tabIndex = ["RequiredDocuments", "AdditionalDocuments"];
$( "#tabs" ).tabs({
    create: function(event, ui) {
        var index = ui.tab.index();
        window.location.hash = tabIndex[index];
    },
    activate: function(event, ui) {
        var index = ui.newTab.index();
        window.location.hash = tabIndex[index];
    },
    active: currentTab.length !== 0 && tabIndex.hasOwnProperty(currentTab) ? tabIndex.indexOf(currentTab) : 0
});

구버전은 아래처럼.

var currentTab = window.location.hash.substring(1);
var tabIndex = ["RequiredDocuments", "AdditionalDocuments"];
$("#tabs").tabs({
    show: function(event, ui) {
        window.location.hash = tabIndex[ui.index];
    },
    selected: currentTab.length !== 0 && tabIndex.hasOwnProperty(currentTab) ? tabIndex.indexOf(currentTab) : 0
});

 

2019. 12. 26. 09:02

[Jquery] Textarea 높이 자동

$("textarea").each(function() {
var offset = this.offsetHeight - this.clientHeight;
var resizeTextarea = function(el) {
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
};
$(this).on('keyup input focusin', function() { resizeTextarea(this); });
});


2019. 11. 29. 15:05

[MSSQL] GeoLocation 범위계산

alter table [yourTable] add [p] as geography::Point(Latitude, Longitude, 4326) persisted;
create spatial index [yourSpatialIndex] on [yourTable] ([p])

declare @Latitude float = <somevalue>, @Longitude float = <somevalue>;
declare @point geography = geography::Point(@Latitude, @Longitude, 4326);
declare @distance int = <distance in meters>;

select * from [yourTable] where @point.STDistance([p]) <= @distance;