본문 바로가기

TIL38

[Android] 레이아웃(Layout) - LinearLayout, TableLayout, RelativeLayout 레이아웃(Layout)이란? 레이아웃은 여러 뷰들을 포함하고 배치하는 역할을 하며, 레이아웃 클래스는 모두 ViewGroup 클래스로부터 상속 받는다. 따라서 View 클래스와 ViewGroup 클래스의 메소드와 필드 모두 사용 가능하다. 레이아웃 클래스 설명 LinearLayout 자식들을 수직이나 수평으로 배치 TableLayout 자식들을 테이블 형태로 배치 GridLayout 자식들을 바둑판 모양으로 배치 RelativeLayout 자식들을 부모나 다른 자식에 상대적으로 배치 ConstraintLayout 자식들을 부모나 다른 자식에 상대적으로 배치 TabLayout 탭을 이용하여서 겹쳐진 자식 중에서 하나를 선택 AbsoluteLayout 절대 위치로 배치 FrameLayout 모든 자식들을 겹.. 2022. 11. 9.
[Flask] Flask 어플리케이션 작성 및 실행 / 환경변수 설정 Flask 어플리케이션 작성 Flask가 정상적으로 설치가 완료 되었으면, app.py 파일을 생성 후 아래코드를 복사해 실행시켜 본다. from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello World!' if __name__ == '__main__': app.run() Flask 어플리케이션 코드 설명 코드를 간략히 설명하자면 from flask import Flask flask의 라이브러리에서 Flask라는 class를 improt 한다. 해당 클래스가 WSFI (Web Server Gateway Interface) 어플리케이션 역할을 할 것이다. app = Flask(__name__) app =.. 2022. 11. 9.
[Flask] Flask 환경 설정 / 파이썬 가상 환경 venv / Vscode Flask 가상환경 설정 및 진입 Flask 실행하기 위한 환경 설정 flask 를 실행하기 위해서는 개발 환경을 세팅해주어야 한다. 나는 Visual Studio Code를 통해 Flask 를 실행하고 가상환경을 설정할 것이다. 1. Visual Studio Code를 열어 터미널을 켜, PowerShell을 cmd로 변경한다. (1) Visual Studio Code 상단에 보기(v) -> 터미널을 클릭한다. (2) 터미널을 powershell에서 Command Prompt 로 변경한다. 2. 파이썬 가상환경 생성하기 (1) 가상 환경을 만들 폴더 생성 파이썬 가상환경을 생성할 주소를 지정하기 위해, 나는 로컬 디스크 C 에 dev라는 폴더를 생성 후 python 폴더를 생성하고 python 폴더 안에 가상 환경을 설정할 venvs .. 2022. 11. 8.
[Flask] Flask란? / Flask 장단점 및 Django 차이점 / Flask 사용 이유 및 용도 Flask (플라스크) 란? Flask는 파이썬 기반으로 작성된 마이크로 웹 프레임 워크(Micro Web Framework) 중 하나이다. 간단한 웹 사이트나 혹은 간단한 API 서버를 만드는 데에 특화된 Python Web Framework이다. Flask는 자바가 아닌 파이썬 기반으로 웹 서버를 만들 수 있다. Web Framework (웹 프레임워크)란? 웹 프레임워크는 동적인 웹 페이지나 웹 어플리케이션을 개발할 때 우용하게 사용하는 일종의 '틀(frame)'이다. 일반적으로 데이터베이스(DB) 연동, 템플릿 형태의 표준, 세션 관리, 코드 재사용 등의 기능을 포함한다. Flask 이외의 파이썬 기반의 웹 프레임워크에는 Django, Bottle, Pyramid 가 있다. routing은 사용자.. 2022. 11. 7.
MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - xargs 코드 및 해석 MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - xargs 문제 (Problems) xargs (moderate) Write a simple version of the UNIX xargs program: its arguments describe a command to run, it reads lines from the standard input, and it runs the command for each line, appending the line to the command's arguments. Your solution should be in the file user/xargs.c. The following example illustrates xarg's behav.. 2022. 11. 5.
MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - find 코드 및 해석 MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - find 문제 (Problems) find (moderate) Write a simple version of the UNIX find program: find all the files in a directory tree with a specific name. Your solution should be in the file user/find.c. Some hints: Look at user/ls.c to see how to read directories. Use recursion to allow find to descend into sub-directories. Don't recurse into "." and "..". .. 2022. 11. 5.
MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - pingpong 코드 및 해석 MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - pingpong 문제 (Problems) pingpong (easy) Write a program that uses UNIX system calls to ''ping-pong'' a byte between two processes over a pair of pipes, one for each direction. The parent should send a byte to the child; the child should print ": received ping", where is its process ID, write the byte on the pipe to the parent, and exit; the parent s.. 2022. 11. 5.
MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - sleep 코드 및 해석 MIT 6.828 - 1. Lab 01: Xv6 and Unix utilities - sleep 문제 (Problems) sleep (easy) Implement the UNIX program sleep for xv6; your sleep should pause for a user-specified number of ticks. A tick is a notion of time defined by the xv6 kernel, namely the time between two interrupts from the timer chip. Your solution should be in the file user/sleep.c. Some hints: Before you start coding, read Chapter.. 2022. 11. 5.
[Python 크롤링 ] 4. selenium 사용 find_element 요소 접근 페이지의 특정 element에 접근하는 방식 driver.find_element_by_xpath('//*[@id="main-area"]/div[7]/a[2]') #xpath 로 접근 driver.find_element_by_class_name('some_class_name')#class 속성으로 접근 driver.find_element_by_id('html_id')#id 속성으로 접근 driver.find_element_by_link_text('회원가입')#링크가 달려 있는 텍스트로 접근 driver.find_element_by_css_selector('#css>div.selector')#css 셀렉터로 접근 driver.find_element_by_name('html_name')#name 속성으로 접근.. 2022. 10. 31.