2019年10月3日 星期四

讀書心得 - 大腦衝浪 - 第四講

第四講

主要講的是 ABCDE

A : 指事件

B : 指內心的想法 ( 該 或 不該 )

C : 照著內心想法的後果

ABC 是我常見的思考模型,一想到後果 (C) 反而讓我止步不前,直到下個 (A) 發生,又卡死在 (C),越來越討厭自己。例如我朝思暮想的換工作,(A) 大概是看到自己對現今工作厭惡的地方,(B) 則是老套的精進自己但沒方向,(C) 則是沒救時間慢慢過去。

D : 把 (B) 的"該"改成"不該" ( "不該"則改"該" )

E : 想個理由去支持 (D)

依我的情況就是不該為了厭惡而去精進自己,好的工作可遇不可求,把時時刻刻精進自己的重擔壓在身上只會更想逃避,走入 (C)。也許我該先嘗試著喜愛,慢慢累積,慢慢累積。

2019年10月2日 星期三

Python 數值互換如何運作

在 Python 裡,以下這段 Code 是被允許的
a = 1
b = 2
a, b = b, a  # b = 1, a = 2
其理由是 Python 會計算等號右邊的值,計算完後才將值分配到等號左邊。
可以 import dis 看其實際如何運作。
import dis

def bar(a, b, c, d):
    d, c, b, a = a, b, c, d

dis.dis(bar)
  2           0 LOAD_FAST                0 (a)
              3 LOAD_FAST                1 (b)
              6 LOAD_FAST                2 (c)
              9 LOAD_FAST                3 (d)
             12 BUILD_TUPLE              4
             15 UNPACK_SEQUENCE          4
             18 STORE_FAST               3 (d)
             21 STORE_FAST               2 (c)
             24 STORE_FAST               1 (b)
             27 STORE_FAST               0 (a)
             30 LOAD_CONST               0 (None)
             33 RETURN_VALUE    

參考資料 : stackoverflow

讀書心得 - 大腦衝浪 - 第一講

第一講

我的直覺反應為 : 想寫樂譜,然後彈

我想會這樣想是因為想要一個人明確的告訴我方向。就像求學階段一樣,有教科書加上參考書能讓我在考試上面獲取高分,進入好的學校。就業了,沒有權威的教科書和有計畫學習的教科書,甚至沒有考試,但我仍想進入好公司,真矛盾。

也許我該直接的把那小提琴拿起來把玩,找到我最喜歡的音,找不到最喜歡也會找到相似的。也許我該直接多方面試,找到我最喜歡的工作。

2019年8月15日 星期四

英文歌詞翻譯 Lauv - f*ck, i'm lonely (with Anne-Marie)




[Verse 1: Lauv]

I call you one time, two time, three time
我一遍兩遍三遍地打給你
I  can't wait no more
我再也等不下去
Your  fingers through my hair, that's on my mind
你手指穿過我頭髮的記憶仍在我心頭
I know it's been a minute since you walked right through that door
我知道從你走出門已過了一分鐘
But I still think about you all the time
但我仍然無時無刻在想妳

[Pre-Chorus: Lauv]
I  don't know, I don't know
不知道,不知道
How  I'm gonna make it out
我該如何熬過
I don't know, I don't know
不知道,不知道
Now  you got me sayin'
你讓我說出了

[Chorus: Lauv]
Fuck, I'm lonely, I'm lonely, I'm lonely as Fuck
X!!我好寂寞,好寂寞,寂寞得像X!!
come hold me, come hold me, come hold me
過來抱我,過來抱我,過來抱我
It's been me, myself, and why did you go, did you go?
這裡只剩我了,為何還是要走,還是要走?
Oh,  fuck, I'm lonely, I'm lonely, I'm lonely, lonely, I
喔...X!!我好寂寞,好寂寞,寂寞得像X!!

[Verse 2: Anne-Marie]
Yeah, I still watch the shows you showed me
我依然在看你給看的節目
I still drink that wine
我依然喝著酒
But these days it tastes more bitter than sweet, hmm
但這些日子似乎不甜反而更苦了
And all my friends are way too drunk to save me from my phone
我的朋友都醉倒了以致無法阻止我打給你
So sorry if I say some things I mean
非常抱歉如果我講了不好的話

[Pre-Chorus: Anne-Marie & Lauv]
I don't know, I don't know
不知道,不知道
How I'm gonna make it out
我該如何熬過
I don't know, I don't know
不知道,不知道
Now you got me sayin'
你讓我說出了

[Chorus: Anne Marie & Lauv, Anne-Marie]
Fuck, I'm lonely, I'm lonely, I'm lonely as Fuck
X!!我好寂寞,好寂寞,寂寞得像X!!
come hold me, come hold me, come hold me
過來抱我,過來抱我,過來抱我
It's been me, myself, and why did you go, did you go?
這裡只剩我了,為何你還是要走,還是要走?
Oh, fuck, I'm lonely, I'm lonely, I'm lonely, lonely, I
喔...X!!我好寂寞,好寂寞,寂寞得像X!!

[Bridge: Lauv with Anne-Marie, Anne-Marie]
I miss those nights when you would come over
我想念那些你會過來的夜晚
Spent all night just tryna get closer
花了一整個晚上只為了讓彼此更親密
That was June and now it's October
那時是6月,但現在已是10月
I don't want, don't want to get over
我不想,我不想結束

I miss those nights when you would come over
我想念那些你會過來的夜晚
Spent all night just tryna get closer
花了一整個晚上只為了讓彼此更親密
That was June and now it's October
那時是6月,但現在已是10月
I don't want, don't want to get over you
我不想,我不想忘記你
Oh, get over you (Oh)
忘記你...

[Chorus: Lauv & Anne-Marie, Lauv]
Fuck, I'm lonely, I'm lonely, I'm lonely as Fuck
X!!我好寂寞,好寂寞,寂寞得像X!!
come hold me, come hold me, come hold me
過來抱我,過來抱我,過來抱我
It's been me, myself, and why did you go, did you go?
這裡只剩我了,為何你還是要走,還是要走?
Oh, fuck, I'm lonely, I'm lonely, I'm lonely, lonely
喔...X!!我好寂寞,好寂寞,寂寞得像X!!

[Outro: Lauv & Anne-Marie, Lauv]
I miss those nights when you would come over (Yeah)
我想念那些你會過來的夜晚
Spent all night just tryna get closer
花了一整個晚上只為了讓彼此更親密
That was June and now it's October
那時是6月,但現在已是10月
I don't want, don't want to get over
我不想,我不想結束
I miss those nights when you would come over
我想念那些你會過來的夜晚
Spent all night just tryna get closer
花了一整個晚上只為了讓彼此更親密
That was June and now it's October
那時是6月,但現在已是10月
I don't want, don't want to get over you
我不想,我不想忘記你

(Hmm, hmm)

2019年7月23日 星期二

MySQL 備份

備份 MySQL


備份單一資料庫
mysqldump -u root -p database_name > backup.sql
備份多個資料庫
mysqldump -u root -p --databases db1 db2 > backup.sql
備份全部資料庫
mysqldump -u root -p --all-databases > backup.sql
備份單一資料表
mysqldump -u root -p database_name table_name > backup.sql
備份多個資料表
mysqldump -u root -p database_name table1 table2 > backup.sql
備份資料庫除了特定資料表
mysqldump -u root -p database --ignore-table=database.table1 > database.sql


導入 MySQL


導入單一資料庫
mysql -u root -p database_name < backup.sql
導入多個資料庫
mysql -u root -p < backup.sql

2019年7月9日 星期二

英文歌詞翻譯 OneRepublic - Start Again ft. Logic



Can't I just turn back the clock?
能否讓我就這樣倒轉時間
Forgive my sins
赦免我的罪孽
I just wanna roll my sleeves up
我只想捲起袖子
And start again
重新一遍
I know that I messed it up
我知道我搞砸了
Time and time again
一次又一次
I just wanna roll my sleeves up
我只想捲起袖子
And start again
重新一遍

I was switchin' up the lanes
我曾嘗試不同的路
Steppin' out the frame I'm in
離開原本的圈子
I was pulling on the reins
重新掌握自己 (註一)
Sick of all the same happenin'
厭倦一成不變的人生
I swear I was looking for disaster mixed with a bottle of gin
我認真地希望一場災難能毀滅一切
And just because I come home after
因為即使我回來
Doesn't mean you'll take me in
也不代表你會接受我

You see my world is spinning like there's nothing to know
你目睹我的世界旋轉著就像沒有東西可以認知
You see my world is feeling like it just might explode
你目睹我的世界瀕臨爆炸邊緣
And yes I know it's hard to take it backwards from my mind
對, 我知道一切很難挽回 (註二)
I need to get a ride, need to see some light come in
我需要去兜風喘口氣

Feelin' like maybe I'm unappreciated
就像我不再受你歡迎
Like my presence in your life has been alleviated
就像我的存在對你來說已不重要 (註三)
I feel like everything I've done before is different now
就像我留下的痕跡已逐漸消逝
But I can see clearer than ever from a distance now
但我現在能看清楚了因為這距離
Every day I do it, I been goin' through it
我每天都想挽回一切
But you never knew it 'cause I never showed you
但你不會知道,因為我不會表現出來
You gave me the world, so I feel I owed you
你曾經給了我全世界,所以我覺得我虧欠你
I been lookin' through the mirror and that's the old you
我看著鏡子卻出現曾經的你
I'ma get it right now, don't know how
我想我知道了,只是不知道如何挽回
But I promise that we're gonna make it somehow
但我承諾我們一定能回到當初
I'm all in, it's from the heart again
我會再次從心底付出我的所有
Open up your mind and maybe we could start again
你是否能敞寬心扉讓我們重新一遍


註解
  1. reins : 韁繩
  2. take it backwards : = have it backwards = get it backwards
  3. alleviated : 緩解

MySQL with "localhost"

前言

     移植(複製)系統後,新系統很慢

     事情是這樣的,公司成立分部,鑑於前輩們 (都走了) 建的系統很好用

     公司讓我去建一個到分部,我心裡 OS : 複製貼上我最會 !!

     一切都很順利,安裝  PHP 然後 Hello World ~~

     安裝 Mysql 匯出匯入,會 Google 的都會,直到我開啟系統...好慢...

檢查步驟 1 : 打開"開發者人員選項"


     不急不慌先怪硬體...,開玩笑的...請按 F12

     開了 F12 就發現 Hello World 很快,但系統很慢...

     再仔細觀察發現連結資料庫特很慢 ( 圖檔很快 )


檢查步驟 2 : 檢查 Mysql 


     我第一個想法,我要去優化前輩們的 SQL,結果大概是 2.2 秒 變 2 秒...

檢查步驟 3 : Google it !!


     Google 結果發現問題出在 localhost 身上

     當你連結資料庫時,hostname = "localhost",此時 Server 會找 localhost 所對應的 IP 位置

     只要你沒特別將 localhost 導向 127.0.0.1,那就會找 ::1,IPv6 裡的主機本身

     鑒於 Mysql 並沒設定開啟 IPv6 所以你就只能等,等 Server 用 ::1發現不行才會換 127.0.0.1

     造成連結資料庫特很慢的結果。

解決辦法

     解決辦法有 3 種

     1. 把系統裡的 hostname 通通從 localhost 改成 127.0.0.1

          如果你前輩有先見之明,它會是全域參數,改一下就好

          若不是...見一個改一個...

     2. 設定主機的 localhost 讓其導向 127.0.0.1 

          這我不會,附上參考資料
          http://iamshowp.blogspot.com/2010/05/127001localhostipv6.html

     3. Enable Mysql IPv6 

          這最簡單,最推薦

          修改 config
[mysqld]
bind_address = 127.0.0.1,::1
重啟 MySQL (windows指令)
net stop mysql
net start mysql

參考資料 : https://dev.mysql.com/doc/refman/5.5/en/ipv6-local-connections.html

Popular Posts