반응형

전체 글 1479

sh 와 bash 차이

질문자 :Weiwei Yang쉘 프로그램을 작성할 때 /bin/sh 및 /bin/bash 자주 사용합니다. 나는 보통 bash 사용하지만 그들 사이의 차이점이 무엇인지 모르겠습니다. bash 와 sh 의 주요 차이점은 무엇입니까? bash 와 sh 프로그래밍할 때 알아야 할 사항은 무엇입니까?sh가 뭐야? sh (또는 Shell Command Language)는POSIX 표준에서 설명하는 프로그래밍 언어입니다. 많은 구현이 있습니다( ksh88 , dash , ...). bash sh 의 구현으로 간주될 수도 있습니다(아래 참조). sh 는 구현이 아니라 사양이기 때문에 /bin/sh 는 대부분의 POSIX 시스템에서 실제 구현에 대한 심볼릭 링크(또는 하드 링크)입니다. bash 란 무엇입니까? bas..

List changes unexpectedly after assignment. Why is this and how can I prevent it?

While using new_list = my_list, any modifications to new_list changes my_list every time. Why is this, and how can I clone or copy the list to prevent it? With new_list = my_list, you don't actually have two lists. The assignment just copies the reference to the list, not the actual list, so both new_list and my_list refer to the same list after the assignment. To actually copy the list, you hav..

How to make function decorators and chain them together?

How can I make two decorators in Python that would do the following? @makebold @makeitalic def say(): return "Hello" ...which should return: "Hello" I'm not trying to make HTML this way in a real application - just trying to understand how decorators and decorator chaining works. If you are not into long explanations, see Paolo Bergantino’s answer. Decorator Basics Python’s functions are objects..

How do I test a private function or a class that has private methods, fields or inner classes?

How do I unit test (using xUnit) a class that has internal private methods, fields or nested classes? Or a function that is made private by having internal linkage (static in C/C++) or is in a private (anonymous) namespace? It seems bad to change the access modifier for a method or function just to be able to run a test. Update: Some 10 years later perhaps the best way to test a private method, ..

How to stop EditText from gaining focus at Activity startup in Android

I have an Activity in Android, with two elements: EditText ListView When my Activity starts, the EditText immediately has input focus (flashing cursor). I don't want any control to have input focus at startup. I tried: EditText.setSelected(false); EditText.setFocusable(false); No luck. How can I convince the EditText to not select itself when the Activity starts? Excellent answers from Luc and M..

반응형