기본 콘텐츠로 건너뛰기

2014의 게시물 표시

[vim] how to install and configure jedi-vim

reference: http://redkrieg.com/2012/12/11/writing-python-like-a-jedi/ https://github.com/davidhalter/jedi-vim 1. mkdir -p ~/.vim/autoload ~/.vim/bundle; 2. curl -Sso ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim 3. cd ~/.vim/bundle/ && git clone --recursive https://github.com/davidhalter/jedi-vim.git 4. git submodule update --init 5. echo "\ call pathogen#infect() syntax on filetype plugin indent on let g:SuperTabDefaultCompletionType = "context" set expandtab set tabstop=4 set shiftwidth=4 set smartindent :inoremap jj <Esc>"\ >~/.vimrc

[html] How to store arbitrary data for some HTML tags

source: http://stackoverflow.com/questions/432174/how-to-store-arbitrary-data-for-some-html-tags question: How to store arbitrary data for some HTML tags answer: method1: Which version of HTML are you using? In HTML 5, it is totally valid to have custom attributes prefixed with data-, e.g. <div data-internalid = "1337" ></div> In XHTML, this is not really valid. If you are in XHTML 1.1 mode, the browser will probably complain about it, but in 1.0 mode, most browsers will just silently ignore it. If I were you, I would follow the script based approach. You could make it automatically generated on server side so that it's not a pain in the back to maintain. method 2: If you are using jQuery already then you should leverage the "data" method which is the recommended method for storing arbitrary data on a dom element with jQuery. To store something: $ ( '#myElId' ). data ( 'nameYourData' , { foo : 'bar...

[javascript] What is event bubbling and capturing

source: http://stackoverflow.com/questions/4616694/what-is-event-bubbling-and-capturing question:  What is the difference between event bubbling and capturing? Of the two, which is the faster and better model to use? answer: Event bubbling and capturing are two ways of event propagation in HTML DOM. In bubbling the event is first captured and handled by the inner most element and then propagated to outer elements. In capturing the event is first captured by the outer most element and propagated to the inner most element. During the time of Netscape browser they were advocates of event capturing and Microsoft was from event bubbling school. Both are part of the W3C standard. As per the standard first the event will capture it till it reaches the target then it will bubble up to the outer most element. IE uses only event bubbling where as firefox supports both bubbling and capturing. We can use the  addEventListener(type, listener, useCapture)  to reg...

[javascript, template] Explanation of <script type = “text/template”> … </script>

source: http://stackoverflow.com/questions/4912586/explanation-of-script-type-text-template-script Answer: Those script tags are a common way to implement templating functionality (like in PHP) but on the client side. By setting the type to "text/template", it's not a script that the browser can understand, and so the browser will simply ignore it. This allows you to put anything in there, which can then be extracted later and used by a templating library to generate HTML snippets. Backbone doesn't force you to use any particular templating library - there are quite a few out there: Mustache ,  Haml ,  Eco , and so on (the one used in the example you linked to is  underscore.js ). These will use their own syntax for you to write within those script tags. Obsolete way to implement: <script id = "hello" type = "text/template" > Hello world </script> <script> alert ( $ ( '#hello' ). html ()); </scri...

[css] What's the difference btw CSS classes ".foo.bar"(no space) and ".foo .bar"(with space) and ".foo, .bar"(comma)?

source: http://stackoverflow.com/questions/10036156/whats-the-difference-between-css-classes-foo-bar-without-space-and-foo-bar question: What's the difference between CSS classes .foo.bar (without space) and .foo .bar (with space) [duplicate] I think you got a slight misunderstanding what the first one means. . element . symbol {} Means that those CSS settings are applied to any HTML object with the class  .symbol  that is inside a object with the class  .element . <div class = "element" > <div class = "symbol" /> </div> In this example your first CSS entry would effect the  <div>  tag in the middle. Your second example means that the first class requires two classes to be affected. Other than that its equal to the first one. <div class = "element large" > <div class = "symbol" /> </div> So if the HTML looks like this, the CSS values will be applied to the inner  ...

[linux] Where do you put your websites(web apps) in linux server? /var/www, or /home/website, or else

source: http://serverfault.com/questions/102569/should-websites-live-in-var-or-usr-according-to-recommended-usage Question: Should websites live in /var/ or /usr/ according to recommended usage? Answer: According to the  FHS ,  /usr  is for  shareable, read-only data  - not where you want to put the website. This is where you should put your code (for example Fedora does this for Wordpress). See also the web assets  packaging guide for Fedora. /var  is "variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files." -- better, but still not quite right -- but a lot of systems will use  /var/www , so even if you're wrong to put it there you're in good company. /srv  is for "site-specific data which is served by this system." -- which seems like a good match, but is much less common than  /var/www . The other common place to put the site files is under...

[ubuntu] 한글 한영전화 해결책

reference: http://myubuntu.tistory.com/808 우분투 13.10 한영 전환 문제를 간편 해결책 시작하기전에 Note: 우분투 12.04 LTS에서는 아래와 다른 설정 절차를 거쳤던걸로 기억합니다. 12.04용은 따로 검색해보시는게 날것 같습니다. 1. 시스템 설정 > 언어 패키지 받기 우분투 설치 후 [시스템 설정]-[언어 지원]을 열어 추가로 받는 꾸러미를 다 받습니다. 그리고 한글을 맨 위로 끌어다 놓고 시스템 전체 적용을 합니다. 키보드 입력기는 현재 ibus일 것입니다. 여기까지 진행 후  로그아웃후 다시 로그인 합니다. 기존에 영어로 설치한 경우엔 비로소 한글로 보이기 시작할 것입니다.(애초에 설치시 언어를 한글로 선택했을시엔 해당없음) 2. 시스템 설정 > 텍스트 입력 이번에는 키보드 배치를 추가합니다. 여기서 한글 관련은 딱 두개가 나타납니다. '한국어' 와 '한국어(101/104키 호환)' 입니다. 그런데 이 둘중 무엇을 해도 한글 문제는 해결되지 않을 것입니다. 우리가 원하는건 '한글(Hangul)'입니다. 이것이 나타나게 하려면 nabi를 설치합니다. $ sudo apt-get update && sudo apt-get install nabi -y 이것을 설치하면 비로소 1번에서 보았던 키보드 입력기에 nabi가 추가될 것이며(이를 선택합니다) 키보드 배치에는 한글관련 세번째 항목인 '한글(Hangul)'이 생겨납니다. 이를 추가합니다. 또한 키보드 배치 전환키를 ctrl+space로 변경합니다. (한영키로 한영전환은 간략한 설명을 위해 여기서 제외합니다. go googling!)  3. 마무으리 이 상태로 잘될 수도 있고, 로그아웃 후 다시 해보면 잘 될수도 있습니다. 이제 한글을 입력할 수 있다는 심볼로 우측상한에 태극기가 뜹니다. 저는 바로 잘됐습니다만, 다른...

[django] how to set up django templates folders

source: http://stackoverflow.com/questions/15411164/django-templates-folders Did you set  TEMPLATE_DIRS  in your  settings.py ? Check and make sure it is set up correctly with absolute paths. This is how I make sure it is properly set: settings.py PROJECT_ROOT = os . path . abspath ( os . path . dirname ( __file__ )) TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. os . path . join ( PROJECT_ROOT , 'templates' ). replace ( '\\' , '/' ), ) # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader' , 'django.template.loaders.app_directories.Loader' , # 'django.template.loaders.eggs.Loader', ) This way, I have a  templates  fold...