반응형
반응형

좋은 부모가 되기란 정말 어렵다.
아이를 사랑하는 마음만으로는 아이를 제대로
키울 수 없기 때문이다. 아동기에 나타나는
낮은 자존감과 자신감의 결여는 부모가
아이 양육에 대한 구체적인 준비 없이
키웠기 때문이다. 가장 시급한 준비는
아이에게 엄청난 영향을 주는 말을
어떻게 사용할지를 공부하는
일이다.


- 신언혁의《지혜롭게 키운 자녀가 성공한다》 중에서 -


* 부모된 사람은
자식들을 말로 키웁니다.
사랑의 말, 훈계의 말, 꿈꾸게 하는 말...
하지만 부모의 사랑의 말이 때때로 자식들에게는
미움의 말로 전달됩니다. 훈계의 말은 반항으로,
꿈꾸게 하는 말은 현실을 모르는 황당한 말로
받아들입니다. '잘 말하는 법'을 공부해야
좋은 부모가 될 수 있습니다.

반응형

'아침편지' 카테고리의 다른 글

허준과 유의태  (0) 2013.09.16
멋지게 살기 위해서  (0) 2013.09.14
감각을 살려라  (0) 2013.09.12
맛있는 밥  (0) 2013.09.11
의식 있는 진화  (0) 2013.09.10
반응형

URL 인코딩으로 알려진 인코딩의 공식 명칭은 Percent-encoding이다.

URL (Uniform Resource Locator)뿐만 아니라 URN (Uniform Resource Name)도 포함하는

URI (Uniform Resource Identifier)에서 사용하는 인코딩이다.

URI에 허용되는 문자는 크게 reserved와 unreserved로 나뉜다.

 

$("#sns_url").keyup(function(event){
            if (!(event.keyCode >=37 && event.keyCode<=40)) {
                var inputVal = $(this).val();
                $(this).val(inputVal.replace(/[^a-z0-9!*();:@&=+$%,./?#_]/gi,''));
            }
        });

 

 

reserved 문자는 다음과 같다.

! * ' ( ) ; : @ & = + $ , / ? # [ ]

unreserved 문자는 다음과 같다.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 - _ . ~

reserved와 unreserved에 해당하지 않는다면,

모두 Percent-encoding되어야 한다.

reserved 문자는 특별한 의미를 갖는데

특별한 의미없이 사용하려면, Percent-encoding되어야 한다.

Percent-encoding은 ASCII인 경우 ASCII 값의 16진수 표현 앞에 %를 붙인다.

non-ASCII인 경우 인코딩에 따라 각 바이트를 16진수 표현으로 바꾸고 앞에 %를 붙인다.

다음은 각 reserved 문자의 Percent-encoding 값이다.

! # $ & ' ( ) * + , / : ; = ? @ [ ]
%21 %23 %24 %26 %27 %28 %29 %2A %2B %2C %2F %3A %3B %3D %3F %40 %5B %5D

unreserved 문자의 경우 인코딩될 필요도 없고,

인코딩하더라도 자기 자신이 반환된다.

마찬가지로 unreserved 문자를 디코딩하더라도 자기 자신이 반환된다.

Reference:
http://en.wikipedia.org/wiki/Percent-encoding

반응형
반응형
<html>
<head>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#input1").keyup(function(event){
if(event.keyCode !=8){
var result = "keycode="+ event.keyCode + " value="+ String.fromCharCode(event.keyCode);
var preHtml = $("#result").html();
$("#result").html(preHtml+ "<br />" +result);
}
if($(this).val() ==""){
$("#result").empty();
}
});
$("#onlyNumber").keyup(function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[^0-9]/gi,''));
}
});
$("#onlyAlphabet").keyup(function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[^a-z]/gi,''));
}
});
$("#notHangul").keyup(function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[^a-z0-9]/gi,''));
}
});
$("#onlyHangul").keyup(function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[a-z0-9]/gi,''));
}
});
});
</script>
</head>
<body>
숫자만: <input type="text" id="onlyNumber" /> <br />
영문만: <input type="text" id="onlyAlphabet" /> <br />
영문,숫자만:<input type="text" id="notHangul" /><br />
한글만:<input type="text" id="onlyHangul" /><br />
keyCode: <input type="text" id="input1" />
<div id="result">
</div>
</body>
</html>
반응형
반응형

민원, 등본, 초본  발급 - 민원24

 

http://www.minwon.go.kr/

반응형
반응형

jQuery.textcomplete: Autocomplete for textarea

자동완성

 

Forms - jQuery/Added on September 11, 2013/Add to favorites

jQuery.textcomplete is a jQuery plugin that adds an autocomplete feature to textareas, like the ones found in GitHub comment forms. It’s completely open source, released under the MIT license.

jquery textcomplete

Homepage: http://yuku-t.com/jquery-textcomplete/
GitHub: https://github.com/yuku-t/jquery-textcomplete

 

 

Autocomplete for Textarea

Introduces autocompleting power to textareas, like a GitHub comment form has.

DemoDemo.

How to use

Note: The key words "MUST", "SHOULD", and "MAY" in this document are to be interpreted as described in RFC 2119.


jQuery MUST be loaded ahead.

<script src="path/to/jquery.js"></script>
<script src="path/to/jquery.textcomplete.js"></script>

Then jQuery.fn.textcomplete is defined. The method MUST be called for textarea elements, and the receiver SHOULD include an element.

$('textarea').textcomplete(strategies);

The strategies is an Object not an Array. Each value is called a strategy object and the corresponding key is the name of the strategy.

var strategies = {
  // There are two strategies called 'foo' and 'bar.'
  // The plugin does not care these property names so you should use
  // meaningful names.
  foo: strategy,
  bar: otherStrategy
};

The strategy is an Object which MUST have match, search and replace and MAY have index, maxCount and template.

var strategy = {
  // Required
  match:    matchRegExp,
  search:   searchFunc,
  replace:  replaceFunc,

  // Optional
  index:    indexNumber,
  maxCount: maxCountNumber,
  template: templateFunc,
  cache:    cacheBoolean
}

The matchRegExp and indexNumber MUST be a RegExp and a Number respectively. matchRegExp MUST contain capturing groups and SHOULD end with $. indexNumber defaults to 2. The word captured by indexNumber-th group is going to be the term argument of searchFunc.

// Detect the word starting with '@' as a query term.
var matchRegExp = /(^|\s)@(\w*)$/;
var indexNumber = 2;

The searchFunc MUST be a Function which gets two arguments, term and callback. It MUST invoke callback with an Array of String. It is guaranteed that the function will be invoked exclusively even though it contains async call.

If you want to execute callback multiple times per a search, you SHOULD give true to the second argument while additional execution remains. This is useful to use data located at both local and remote. Note that you MUST invoke callback without truthy second argument at least once per a search.

The maxCountNumber MUST be a Number and default to 10. Even if searchFunc callbacks with large array, the array will be truncated into maxCountNumber elements.

The cacheBoolean MUST be a Boolean. It defaults to false. If it is true the searchFunc will be memoized by term argument. This is useful to prevent excessive API access.

var searchFunc = function (term, callback) {
  // Show local cache immediately.
  callback(cache[term], true);

  $.getJSON('/search', { q: term })
    .done(function (resp) {
      // Resp must be an Array of String such as:
      //   ['hello', 'world']
      callback(resp);
    })
    .fail(function () {
      // Callback must be invoked even if something went wrong.
      callback([]);
    });
};

The templateFunc MUST be a Function which gets and returns a string. The function is going to be called as an iteretor for the array given to the callback of searchFunc.

var templateFunc = function (value) {
  return '<b>' + value + '</b>';
};

The replaceFunc MUST be a Function which gets and returns a string. It is going to be invoked when a user will click and select an item of autocomplete dropdown.

var replaceFunc = function (value) { return '$1@' + value + ' '; };

The result is going to be used to replace the textarea's text content using String.prototype.replace with matchRegExp:

textarea.value = textarea.value.replace(matchRegExp, replaceFunc(value));

Example

var emojies = ['+1', '-1', 'dog', 'cat'];

$('textarea').textcomplete({
  // mention strategy
  mention: {
    match: /(^|\s)@(\w*)$/,
    search: function (term, callback) {
      callback(cache[term], true);
      $.getJSON('/search', { q: term })
        .done(function (resp) { callback(resp); })
        .fail(function ()     { callback([]);   });
    },
    replace: function (value) {
      return '$1@' + value + ' ';
    },
    cache: true
  },

  // emoji strategy
  emoji: {
    match: /(^|\s):(\w*)$/,
    search: function (term, callback) {
      var regexp = new RegExp('^' + term);
      callback($.map(emojies, function (emoji) {
        return regexp.test(emoji) ? emoji : nil;
      }));
    },
    replace: function (value) {
      return '$1:' + value + ': ';
    }
  }
});

Style

The HTML generated by jquery-textcomplete is compatible with Bootstrap's dropdown. So all Bootstrap oriented css files are available.

This repository also includes jquery.autocomplete.css. It is useful to be used as the starting point. 

 

반응형
반응형

[mssql]  숫자 앞에 0 으로 채우기, Replicate

 


-- 2013-9-2
select YEAR(getDate()), Month(getdate()), day(getdate())


-- 2013-09-02
select YEAR(getDate()), replicate('0',2 - len(Month(getdate()))) + cast(Month(getdate()) as varchar), replicate('0',2 - len(day(getdate()))) + cast(day(getdate()) as varchar)

반응형

+ Recent posts