내꺼
딸래미꺼
'개소리 왈왈 > 모바일 생활' 카테고리의 다른 글
요금제 변경 (4) | 2023.06.01 |
---|---|
터치 안되는 핸드폰 끄기(안드로이드) (0) | 2022.12.02 |
아이패드 초기화 하기 (0) | 2022.07.27 |
freeT SKT -> freeT KT 번호이동 (0) | 2022.06.07 |
요금제 변경 시도 (0) | 2022.06.02 |
내꺼
딸래미꺼
요금제 변경 (4) | 2023.06.01 |
---|---|
터치 안되는 핸드폰 끄기(안드로이드) (0) | 2022.12.02 |
아이패드 초기화 하기 (0) | 2022.07.27 |
freeT SKT -> freeT KT 번호이동 (0) | 2022.06.07 |
요금제 변경 시도 (0) | 2022.06.02 |
func createCookie(w http.ResponseWriter, req *http.Request) { http.SetCookie(w, &http.Cookie{ Name: "name of cookie", Value: "value of cookie", Path: "/", }) } func expireCookie(w http.ResponseWriter, req *http.Request) { cookie, err := r.Cookie("cookie-name") if err := nil{ } // 1. 쿠키 삭제 // cookie.MaxAge = -1 // 2. 쿠키를 5초간 지속 // cookie.MaxAge = 5 // 3. expires 설정, 현재시간으로 부터 1시간 뒤 == 쿠키의 만료시각 // expiration := time.Now().Add(time.Hour) // cookie.Expires = expiration http.SetCookie(w, cookie) http.Redirect(w, req, "/", http.StatusSeeOther) } |
[링크 : https://velog.io/@j1mmyson/golang-go언어에서의-쿠키-사용]
go 루틴 (0) | 2022.09.06 |
---|---|
golang https server (0) | 2022.09.05 |
golang http redirect (0) | 2022.09.02 |
golang html form post 처리하기 (0) | 2022.09.02 |
golang http.HandleFunc(pattern) (0) | 2022.08.31 |
form post 로 받아서 DB로 조회하고 성공시, 어떻게 다른 링크로 돌려보내나 고민을 했는데
http.Redirect()라는 함수를 발견. StatusSeeOther는 303 코드인데 좀.. 생소하네?
if r.Method == "POST" { saveChoice(r.Form["choices"]) http.Redirect(w, r, newUrl, http.StatusSeeOther) } |
[링크 : https://stackoverflow.com/questions/35934298/how-to-redirect-to-a-url]
특이하게도.. Response와 Request 둘다 들어와야 쓸 수 있는 녀석.
func Redirect(w ResponseWriter, r *Request, url string, code int) Redirect replies to the request with a redirect to url, which may be a path relative to the request path. The provided code should be in the 3xx range and is usually StatusMovedPermanently, StatusFound or StatusSeeOther. If the Content-Type header has not been set, Redirect sets it to "text/html; charset=utf-8" and writes a small HTML body. Setting the Content-Type header to any value, including nil, disables that behavior. |
golang https server (0) | 2022.09.05 |
---|---|
golang 쿠키 (0) | 2022.09.02 |
golang html form post 처리하기 (0) | 2022.09.02 |
golang http.HandleFunc(pattern) (0) | 2022.08.31 |
golang mariadb 연동 (0) | 2022.08.30 |
오랫만에 HTML 하니 다 까먹었네..
html 에서는 아래와 같이 post로 넘겨줄 변수 명은 name에 기재하고 form method를 post로 해주면 끝!
다만 action은 생략될 수 있으므로 처리해야할 페이지의 링크를 기록해주면 된다.
<form method="post" action="url"> <intut type="text" name="username"> </form> |
func loginHandler(wr http.ResponseWriter, r *http.Request) { r.ParseForm() switch r.Method { case http.MethodPost: // 조회 fmt.Println(r) fmt.Println(r.Form) fmt.Println(r.PostForm) fmt.Fprintln(wr, r.Form) } } |
[링크 : https://dksshddl.tistory.com/entry/Go-web-programming-request-처리-및-response-작성]
ParseForm() 을 실행하지 않으면, r.Form이 업데이트 되지 않아 내용이 조회가 되지 않는다.
ParseForm populates r.Form and r.PostForm. For all requests, ParseForm parses the raw query from the URL and updates r.Form. For POST, PUT, and PATCH requests, it also reads the request body, parses it as a form and puts the results into both r.PostForm and r.Form. Request body parameters take precedence over URL query string values in r.Form. If the request Body's size has not already been limited by MaxBytesReader, the size is capped at 10MB. For other HTTP methods, or when the Content-Type is not application/x-www-form-urlencoded, the request Body is not read, and r.PostForm is initialized to a non-nil, empty value. ParseMultipartForm calls ParseForm automatically. ParseForm is idempotent. |
[링크 : https://pkg.go.dev/net/http#Request.ParseForm]
html post를 직접 하는건데 유용한(?) 라이브러리가 보여서 링크!
import "encoding/json" import "encoding/xml" |
golang 쿠키 (0) | 2022.09.02 |
---|---|
golang http redirect (0) | 2022.09.02 |
golang http.HandleFunc(pattern) (0) | 2022.08.31 |
golang mariadb 연동 (0) | 2022.08.30 |
golang channel (0) | 2022.08.18 |
systemctl status 전체 로그 보기 (0) | 2022.11.30 |
---|---|
리눅스 경로 / 와 // 와 /// (0) | 2022.11.01 |
uvcdynctrl (0) | 2022.07.06 |
dmesg -w (0) | 2022.06.30 |
dmesg log_buf_len (0) | 2022.06.29 |
golang을 이용해서 rest 서버를 만드는데 가장 만만한(?) 녀석은
net/http 모듈의 http.HandleFunc() 인데
pattern 이라고 써넣고는 막상 설명이 없다.
func HandleFunc(pattern string, handler func(ResponseWriter, *Request)) |
[링크 : https://pkg.go.dev/net/http#HandleFunc]
음.. 소스를 봐도 모르겠다.
// Handle registers the handler for the given pattern. // If a handler already exists for pattern, Handle panics. func (mux *ServeMux) Handle(pattern string, handler Handler) { mux.mu.Lock() defer mux.mu.Unlock() if pattern == "" { panic("http: invalid pattern") } if handler == nil { panic("http: nil handler") } if _, exist := mux.m[pattern]; exist { panic("http: multiple registrations for " + pattern) } if mux.m == nil { mux.m = make(map[string]muxEntry) } e := muxEntry{h: handler, pattern: pattern} mux.m[pattern] = e if pattern[len(pattern)-1] == '/' { mux.es = appendSorted(mux.es, e) } if pattern[0] != '/' { mux.hosts = true } } |
걍.. gin 모듈을 쓰는게 속 편하려나?
[링크 : https://stackoverflow.com/questions/6564558/wildcards-in-the-pattern-for-http-handlefunc]
golang http redirect (0) | 2022.09.02 |
---|---|
golang html form post 처리하기 (0) | 2022.09.02 |
golang mariadb 연동 (0) | 2022.08.30 |
golang channel (0) | 2022.08.18 |
golang unused import (0) | 2022.07.20 |
select current_timestamp(3) |
[링크 : https://stackoverflow.com/questions/9624284/current-timestamp-in-milliseconds]
NOW([precision]) CURRENT_TIMESTAMP CURRENT_TIMESTAMP([precision]) LOCALTIME, LOCALTIME([precision]) LOCALTIMESTAMP LOCALTIMESTAMP([precision]) |
mariaDB 설치 실패 (0) | 2025.03.04 |
---|---|
mariadb 초기설정 (0) | 2022.08.30 |
mariadb c# connector (0) | 2021.10.22 |
HeidiSQL (2) | 2021.08.18 |
sql zerofill (0) | 2019.11.25 |
SDRangel can decode multiple broadcast FM channels simultaneously |
[링크 : https://www.reddit.com/r/RTLSDR/comments/ql1jpe/problem_rtl_sdr_recording_multiple_fm_channel/]
SDRangel is an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware. |
[링크 : https://github.com/f4exb/sdrangel]
[링크 : https://github.com/f4exb/sdrangelcli]
[링크 : https://github.com/szpajder/RTLSDR-Airband]
[링크 : https://github.com/pvachon/tsl-sdr]
[링크 : https://www.rtl-sdr.com/a-multichannel-fm-demodulator/]
pulseaudio error : access denied (0) | 2024.08.26 |
---|---|
gqrx, gnu radio, rfcat (0) | 2024.08.21 |
ubuntu 18.04에 사운드 카드가 갑자기 사라졌다? (0) | 2022.07.20 |
RTL-SDR 11시 땡! (0) | 2022.01.07 |
gqrx 오디오 스트리밍 (0) | 2022.01.07 |
빨간 해골을 못 찾아서
동영상 따라가면서 추적중 ㅠㅠ
어우.. 공중에 떠있는 돌을 따라서 가는게 왜이렇게 눈에 안들어 왔을 고
ea origin은 어디가고.. (2) | 2023.06.06 |
---|---|
abzu 플레이 (0) | 2023.05.29 |
macos 에픽게임즈 (0) | 2022.05.27 |
macos 스팀 게임 (0) | 2022.05.27 |
epic games - troy (0) | 2020.08.13 |