2022. 8. 13.

OrderedDict. ( in Python)

func: Dictionary remembers added order of items.

Ref : https://docs.python.org/3/library/collections.html


Usecase  sample : convert number to roman numerals.


import string
from collections import OrderedDict

def to_roman(num):
maps = OrderedDict([('M', 1000), ('CM', 900), ('D', 500),
('CD', 400), ('C', 100), ('XC', 90), ('L', 50), ('XL', 40),
('X', 10), ('IX', 9), ('V', 5), ('IV', 4), ('I', 1)])
res = ''
for k, v in maps.items():
while num >= v:
print(f' {num}, {v}')
res += k
num -= v
return res

print(1988)
print(to_roman(1988))

### output #####
1988 1988, 1000 988, 900 88, 50 38, 10 28, 10 18, 10 8, 5 3, 1 2, 1 1, 1 MCMLXXXVIII



2022. 7. 3.

Loading xml data in excel vba by using XML Object(MSXML2.DOMDocument)

### in excel file ( xlsm , macro excel , enable macro) 


' Declare xml object

  set xmlObj = CreateObject("MSXML2.DOMDocument.6.0")

 ' set loading option with non async

 xmlObj.Async = False

' validate off

xmlObj.validateOnParse = False

' reading file from sample.xml 

xmlObj.Load "sample.xml"

' select all "mynode" from root node recursively ( ref. xml path grammar in detail)

' root node에서 mynode 모두 선택하기 추가적인 부분은 xml path 문법을 참고

Set nodeList = xmlObj.SelectNodes("//mynode")

for index to nodeList.Length -1 

    set myNode = nodeList(index)

    ' do somthing 

    aa = myNode.text

next index


2021. 12. 18.

Install node.js as you want with package 'n'

NodeJs install manager 'n'

  • You can install /update  nodejs as you want  with package 'n' 
  • please refer as below link in detail
    •  https://github.com/tj/n


## install   : 

npm install -g n     # 'n' is not option, It's package name. 


2021. 8. 31.

Using simple web server for firewall test (python)

 ## 3.x ( # ref : https://docs.python.org/3/library/http.server.html)

python3 -m http.server  {port}

# ex) run 8888 port

$ python3 -m http.server 8888        







### server1 ####

curl http://server2:8888

> default response is  file listing 

### server2 ####

python3 -m http.server 8888


2021. 8. 16.

build vuejs with new config mode with production build

 ## When you want to use another config values in deploying. you must add NODE_ENV=production


## .env.mynewmode

   NODE_ENV=production                 ##<-- this line makes files for deploying 

   VUE_APP_MY_VAR='mynewvalue' 


## build

npm run build -- --mode mynewmode


#ref: https://cli.vuejs.org/guide/mode-and-env.html#modes



https://cli.vuejs.org/guide/mode-and-env.html#modes