Programming(74)
-
openpyxl sheet
openpyxl import The first thing you need to do is import openpyxl as follow. import openpyxl from openpyxl.styles.borders import Border, Sidedeclare workbook declare a new instance of Workbook wb = openpyxl.Workbook()create a new sheet create the first sheet in the workbook. wb.create_sheet('sheet 1', 0)and get the reference to the sheet sheet = wb.get_sheet_by_name('sheet 1')add..
2021.12.10 -
Go empty interface
(cont.) emptyp interface 모든 type을 "표현"하는 interface 즉, dynamic type이며 이는 Java의 Object, C의 void*와 유사하다. func show(v interface{}) { fmt.Println(v) } var x interface{} x = 1 x = "A" show(x) // "A" func main() { var a interface{} = 1 i := a j := a.(int) // j는 int type, 값은 1 println(i) // pointer address println(j) // 1 }
2021.12.09 -
Golang slice, map, struct
slice slice 선언 s := make([]int, 5, 10) 현재 길이: 5 내부적 길이(capacity) 10의 크기 s := make([]int, 0, 5) 현재 길이: 0 내부 길이: 5 (할당 길이) slice 추가 nodes := make([]*ListNode, 0, 10) chunk_nodes := make([]*ListNode, 0, 10) var node *ListNode node = new(ListNode) chunk_nodes = append(chunk_nodes, node) nodes = append(nodes, chunk_nodes...) ListNode를 pointer로 선언하여 할당 node에 대한 list인 chunk_nodes를 선언 chunk_nodes에 node ..
2021.11.09 -
Golang 기본 문법
1. 변수 1.1 변수 선언 var a int var f float32 = 11. a = 10 f = 12.0사용되지 않는 변수는 error가 발생한다. 아래와 같이 선언만 하고 사용하는 코드가 작성되지 않는다면 error가 발생한다. var i, j, k int = 1, 2, 3:=로 변수의 선언과 할당을 동시에 수행 할 수도 있다. val := 101.2. 상수 var 대신 const를 사용하여 변수를 선언하면 '상수'로서 선언된다. C++의 const와 동일한 keyword를 사용한다. (Kotlin의 경우 val keyword) const c int = 10 const s string = "Hi"Go는 type deduction을 지원한다. 변수 명 뒤에 변수의 type을 지정하지 ..
2021.11.09 -
Golang introduction 2021.11.09
-
gdbus] method 등록 및 호출
gdbus call 1) registration a. generate gdbus wrapping code ex. com.test.module1.xml gdbus-codegen --generate-c-code testbus --c-namespace TestBus --interface-prefix com.test. com.test.module1.xml -> testbus.c/h b. build FLAGS=$(shell pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0) server: server.o testbus.o gcc -o $@ $^ $(FLAGS) client: client.o testbus.o gcc -o $@ $^ $(FLAGS) gcc -o t..
2021.09.27