> Hugo tranquilpeak theme

Router & CORS

1. Basic Setting We are developing a web applications. Gin is for backend and vue is for frontend. However, I often encouter router problems when sending request from frontend to the backend. Here are quick rules to avoid these problems. 2. Router //routers.go func Router() *gin.Engine { r := gin.Default() r.Use(middleware.Cors()) user := r.Group("/user") { user.GET("/test/", controllers.Test) user.GET("/", controllers.GetUsers) user.GET("/:id", controllers.GetUser) user.POST("/new", controllers.NewUser) user.POST("/update/:id", controllers.UpdateUser) } return r } <script> // add end slash const res = await $fetch("http://localhost:8080/user/test/") const res = await $fetch("http://localhost:8080/user/"); // no end slash const res = await $fetch("http://localhost:8080/user/1"); const res = await $fetch("http://localhost:8080/user/new", { .

Continue reading

1. Relative Attributes Extract emotion related features by OpenSMILE toolkit. (384-dim) Train Ranking function (Linear) based on the RA. Normalize the intensity values to the range 0 ~ 1. 2. Intensity Distribution 3. Intensity Embedding Map the real number to high dimensional embedding: (effective) $$Inty*W$$ Combine the neutral and emotional embeddings: (not so effective) $$Neu*(1-Inty)+Emo*Inty$$ Combine the neutral and emotional embeddings: (To be done) $$Neu.detach()(1-Inty)+EmoInty$$

Continue reading

Trap of Javascript

1. Reference before assignment function ShuffleArray(array){ // inplace for (let i=array.length-1; i>0;i--){ var j = Math.floor(Math.random()*(i+1)); [arr[i], arr[j]] = [arr[j], arr[i]]; // no error } } This function not only cannot modify the array, but also affects the global variables! 2. Pass by reference (2d array) arr1 = [[0,0], [1,1]]; arr2 = arr1; console.log(arr1); // output: [[3,0], [1,1]] ??? // console.log(...arr1) instead arr2[0][0] = 3; console.log(arr2); // output: [[3,0], [1,1]] The output will be changed even before the assignment.

Continue reading

Trouble of life

Chapter two As temperature grows colder, I tend to get up late in the morning. The result is that I find myself getting ready to sleep without doing anything useful. I have been living in anxiety and depression. Life seems to be out of my control. I want to change the status quo, but it is not easy. My parents are getting old, but I can’t stay with them. I have to continue my research until graduation, but I have no good experimental results yet.

Continue reading

1. Notes (1) We can’t regard different non-neutral speech pair as similar set, otherwise the emotional intensity labels attract each other. (2) The intensity predictor should be fixed while training the text-to-speech model, otherwise the intensity cannot be controlled. (maybe because the label for each sample always fluctuates)

Continue reading

1. 第一节 回忆过去的时光,我总觉得非常的孤独。 很长一段时间里,我都在为学习而忙碌。相反对于生活上的事情,我总是一副漠不关心的态度。在身边的同龄人看来,我也许是一个勤奋好学的小孩吧。但其实,我这么做只是想通过学习这件事情来得到他人的认可。这种心态,大概是源自我童年的生活。那时候,父母时常忙碌于工作,把我独自留在家中。从那时起我就变得不爱交谈,有什么事情都靠忍耐来克服。慢慢地,我固化成了偏内向的性格。在之后漫长的岁月里,我反复失去了对生活的感悟,逐渐依赖“忙碌”来逃避生活。 说起来,我自认为不是一个天赋异禀的人。我只是抱有“愚公移山”的信念,觉得只要通过努力就可以弥补自己在天资上的不足。事实证明,我确实靠这份执着拿到了一个还算过得去的学历标签。然而,这也就是我个人努力的极限了。我逐渐认识到“人外有人,天外有天”。在这样一个“学习崇拜”的社会环境里,我被迫地成为了一个“书呆子”。这也算是偏执信念的副作用吧。 如果把社交算作一门学问的话,那我可以算是吊车尾的学生了。每次见到他人侃侃而谈,我会感到非常的自卑和恐惧。这种情绪就好像别人家的孩子考了好成绩,而自己却发挥不好被父母责备,被朋友嘲笑。我也想过去改变自己,但这不是一件容易的事情。 在我高中毕业后,这种自我认识开始变得越发深刻。我逐渐意识到,仅仅靠学习上的投入很难再得到他人的认可。从此,我开始变得愈发迷茫和焦虑。我对学习变得不再那么执着了,反而对“善于交际”的标签产生了渴望。但是,这种渴望却激起了我内心更深层次的痛苦。因为过去独来独往的生活,我很难再改变自己去适应这种新的社会环境。 长期陷入这种低迷的情绪,人就会开始变得丧和颓废。对生活充满无力感的我,对生活中的各种事情都感到索然无味。我曾经一度靠沉迷电子游戏和碎片化娱乐来麻痹自我。到后来,我开始对这种虚度光阴的行为感到深深的自责。我开始厌恶自己这种不求上进的态度,于是写下此篇作为反省,并祈祷未来的生活能够发生些许改变。

Continue reading

Internet Basics

1. Open System Interconncetion Reference Model (OSI model) Physical Layer: Network interface controller (网卡), ethernet hub (集线器), network switch, transmission medium. It converts digital bits to electrical, radio or optical signals. Voltage characteristics are defined. Datalink Layer: Medium access control (MAC) layer, logical link control (LLC) layer. Correct errors that may occur in physical layers. Network Layer: Provides to transfer packets from node to node. (IP) Transport Layer: Provides to transfer variable length data sequences from source host to destination host.

Continue reading

Author's picture

LI WEI

苟日新,日日新,又日新

Not yet

Tokyo