.. 내 블로그인데 글쓰기가 없다고?

솔직히 나도 이래서 글쓰기 있는 스킨만 썼는데.. 바보 같은짓이었다;;; 검색한번만 해볼껄;

 

'q' .. Q 키를 누르면 관리화면으로 간다; 거기서 글쓰기하면된다 orz

 

https://stackoverflow.com/questions/6040515/how-do-i-get-month-and-date-of-javascript-in-2-digit-format

 

("0" + this.getDate()).slice(-2)

for the date, and similar:

("0" + (this.getMonth() + 1)).slice(-2)

for the month.

 

근데 이것만으로는 안된다. 1월일때 -3 개월하면... -2라고 들어간다;

 

해서 

d.setMonth(d.getMonth()-3);

 

이런식으로 setMonth 를 해야한다. 




본인은 


Yzngal(사용자 수정/업로드)

스킨을 쓰고 있다. 해당 스킨의 기본 본문 폰트가 작다고 느껴저서 폰트 사이즈를 수정했다.


방법은 간단하다. 


1. admin 에가서 왼쪽 메뉴의 html/css 수정을 누른다

2. edit 화면에서 오른쪽 위에 html/css/파일업로드  가 있는데 css 선택한다.

3. css 641 라인의 font-size 수정하면 된다.


현재 이 웹사이트에 적용된 본문 폰트사이즈는 16으로 해두었다.




intellij 를 쓸때 한가지 주의사항이 있다.


바로 inspection 의 내용인데... 만약 당신이 작성한 혹은 당신이 봐야 할 소스.. 보통은 메서드에 뭔가 표시가 되어있고 too complex to analyze 라고 되어있다면 그 메서드는 inspection 이 되지 못한 상태란걸 알아야 한다.

사실 복잡하다는게 어떤 행위로 인한것인지는 정확히 모른다... 다만 루프등이 들어가고 상태가 변하거나... 너무 길거나 등등 모르겠다;

아무튼 분석하기 복잡하다고 나오는순간 그 메서드 내부에서.. 아래 와 같은 코드가 작성되도 에러를 미리 파악해서 알려주지 못한다는 사실이 중요하다.

예로

List<String> list = null;

list.add("a");


위의 코드는 사실상 널포인터익셉션이 나지만 놀랍게도 분석하지 않은 상태라 에러노티를 하지 않는다. 
참고로 위의 에러에 해당하는 inspection 항목은 'Constant conditions & exceptions' 이다.


그리고 too complex to analyze 에 대해서도 체크를 해보고 싶다면 FindBugs-IDEA 플러그인을 설치할것을 권한다. 잘된다 +_+





from https://github.com/ismailhabib/custom-protocol-detection


(function (window) {


    function _registerEvent(target, eventType, cb) {

        if (target.addEventListener) {

            target.addEventListener(eventType, cb);

            return {

                remove: function () {

                    target.removeEventListener(eventType, cb);

                }

            };

        } else {

            target.attachEvent(eventType, cb);

            return {

                remove: function () {

                    target.detachEvent(eventType, cb);

                }

            };

        }

    }


    function _createHiddenIframe(target, uri) {

        var iframe = document.createElement("iframe");

        iframe.src = uri;

        iframe.id = "hiddenIframe";

        iframe.style.display = "none";

        target.appendChild(iframe);

        return iframe;

    }



    function checkBrowser() {

        var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;

        return {

            isOpera: isOpera,

            isFirefox: typeof InstallTrigger !== 'undefined',

            isSafari: Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0,

            isChrome: !!window.chrome && !isOpera,

            isIE: /*@cc_on!@*/false || !!document.documentMode   // At least IE6

        }

    }


    function getInternetExplorerVersion() {

        var rv = -1;

        if (navigator.appName === "Microsoft Internet Explorer") {

            var ua = navigator.userAgent;

            var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");

            if (re.exec(ua) != null)

                rv = parseFloat(RegExp.$1);

        }

        else if (navigator.appName === "Netscape") {

            var ua = navigator.userAgent;

            var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");

            if (re.exec(ua) != null) {

                rv = parseFloat(RegExp.$1);

            }

        }

        return rv;

    }











// CHROME / BLUR

    function openUriWithTimeoutHack(uri, failCb) {


        var timeout = setTimeout(function () {

            failCb();

            handler.remove();

        }, 1000);


        var handler = _registerEvent(window, "blur", onBlur);


        function onBlur() {

            clearTimeout(timeout);

            handler.remove();

        }


        window.location = uri;

    }





// IE 10 in not win 8+  / BLUR

    function openUriUsingIE10InWindows7(uri, failCb) {

        var timeout = setTimeout(failCb, 1000);

        window.addEventListener("blur", function () {

            clearTimeout(timeout);

        });


        var iframe = document.querySelector("#hiddenIframe");

        if (!iframe) {

            iframe = _createHiddenIframe(document.body, "about:blank");

        }

        try {

            iframe.contentWindow.location.href = uri;

        } catch (e) {

            failCb();

            clearTimeout(timeout);

        }

    }


//IE 9/11   not win 8+  / BLUR

    function openUriWithHiddenFrame(uri, failCb) {


        var timeout = setTimeout(function () {

            failCb();

            handler.remove();

        }, 1000);


        var iframe = document.querySelector("#hiddenIframe");

        if (!iframe) {

            iframe = _createHiddenIframe(document.body, "about:blank");

        }


        var handler = _registerEvent(window, "blur", onBlur);


        function onBlur() {

            clearTimeout(timeout);

            handler.remove();

        }


        iframe.contentWindow.location.href = uri;

    }


// Win 8+

    function openUriUsingIEInWindows8(uri, failCb) {

        if (navigator.msLaunchUri) {

            navigator.msLaunchUri(uri,

                function () {

                    window.location = uri;

                },

                failCb

            );

        }

    }





// FF

    function openUriUsingFirefox(uri, failCb) {

        var iframe = document.querySelector("#hiddenIframe");

        if (!iframe) {

            iframe = _createHiddenIframe(document.body, "about:blank");

        }

        try {

            iframe.contentWindow.location.href = uri;

        } catch (e) {

            if (e.name == "NS_ERROR_UNKNOWN_PROTOCOL") {

                failCb();

            }

        }

    }


// ETC

    function openUriInNewWindowHack(uri, failCb) {

        var myWindow = window.open('', '', 'width=0,height=0');


        myWindow.document.write("<iframe src='" + uri + "'></iframe>");

        setTimeout(function () {

            try {

                myWindow.location.href;

                myWindow.setTimeout("window.close()", 1000);

            } catch (e) {

                myWindow.close();

                failCb();

            }

        }, 1000);

    }











    function openUriUsingIE(uri, failCb) {

        //check if OS is Win 8 or 8.1

        var ua = navigator.userAgent.toLowerCase();

        var isWin8 = /windows nt 6.2/.test(ua) || /windows nt 6.3/.test(ua);


        if (isWin8) {

            openUriUsingIEInWindows8(uri, failCb);

        } else {

            if (getInternetExplorerVersion() === 10) {

                openUriUsingIE10InWindows7(uri, failCb);

            } else if (getInternetExplorerVersion() === 9 || getInternetExplorerVersion() === 11) {

                openUriWithHiddenFrame(uri, failCb);

            } else {

                openUriInNewWindowHack(uri, failCb);

            }

        }

    }



    window.protocolCheck = function (uri, failCb) {

        var browser = checkBrowser();


        function failCallback() {

            failCb && failCb();

        }


        if (browser.isFirefox) {

            openUriUsingFirefox(uri, failCallback);

        } else if (browser.isChrome) {

            openUriWithTimeoutHack(uri, failCallback);

        } else if (browser.isIE) {

            openUriUsingIE(uri, failCallback);

        } else {

            //not supported, implement please

        }

    }

}(window));





from http://social.msdn.microsoft.com/Forums/ie/en-US/a5c294e2-e407-491d-ba6a-b7f7edbcabaf/ie11-cant-post-form-data-to-specific-frame-or-window-dialog-opened-via-windowopen?forum=iewebdevelopment


Problem resolved by support team from Microsoft Developer Support for Internet Explorer.

The frame/dialog targeting problem described above is the result of a change introduced with installation of IE11 on a computer, affecting behavior of User Account Control: Use Admin Approval Mode for the built-in Administrator account setting within local security policy.

This setting can be configured using the Local Security Policy snap-in, in Local Policies / Security Options branch, under Policy item called: "User Account Control: Use Admin Approval Mode for the built-in Administrator account".

In simple terms, the steps needed to correct the problem are:

Before installation of IE11 - no need to do anything on any Windows or IE version to get frame targeting to work under default Admin. It works even with "User Account Control: Use Admin Approval Mode ..." set to Disabled.
 
After installation of IE11  - need to Enable "User Account Control: Use Admin Approval Mode for the built-in Administrator account" to get frame/dialog targeting to work for default Admin.

Confirmed the solution works with IE11 on Windows 2012R2 as well as Windows 7 SPK1, the adjustment takes effect after a restart. There is no need to make any changes to HTML pages.
 




event.preventDefault() vs return false;

우선 둘다 기본 동작을 막는것이다. 이 의미는 만약 checkbox 를 선택했을때 onclick 등에 이벤트를 걸었을시, 해당 이벤트내에서 위의 2가지중 하나를 하면 checkbox 에 check 가 되지 않는다. 물론 펑션의 내용은 잘 실행된다.

아주 좋은 답이 있는데 stackoverflow 에 나와있는 답이다.

간단히 말하면 return false 는 preventDefault() 와 stopPropagation() 의 기능 둘다를 처리한다고 한다.

return false from within a jQuery event handler is effectively the same as calling bothe.preventDefault and e.stopPropagation on the passed jQuery.Event object.

e.preventDefault() will prevent the default event from occuring,e.stopPropagation() will prevent the event from bubbling up and return falsewill do both. Note that this behaviour differs from normal (non-jQuery) event handlers, in which, notably, return false does not stop the event from bubbling up.




방법이야 다를 수 있지만 본인이 사용하는 방법은 다음과 같다.



1. 화면에 마우스 오른쪽 버튼을 눌러서 요소검사를 선택한다.

2. 창이 나오면 그 창의 오른쪽에 톱니바퀴를 선택한다.


3. 팝업창에서 Settings 중 Overrides 를 선택하고,

Show Emulation view in console drawer 를 체크 상태로 만든다.


4. 팝업을 닫고 요소검사 화면으로 돌아와 Elements 를 선택한다.

사실 선택안해도 되지만 포커스가 엉뚱한곳에 가 있어서 삽질하는 유저가 있을수도 있어서 그리하도록 하자는거다.

5. HTML 의 구조화면이 나오는데 여기서 ESC 키를 누른다.

6. 그러면 화면이 분할되면서 아래에 새로운 영역이 보이는데 여기서 Emulation을 선택한다.


7. 이제 기기를 고르거나 각종 에뮬레이션 옵션을 켜서 원하는 기기로 테스트해 볼 수 있다. 그리고 User Agent 를 고르면 거기서 UA 값도 임의로 바꿀 수 있다.



+ Recent posts