Posts

Macbook Restore Time Capsule Backup - File Size too big solution

 If you just bought a new Mac (or Macbook), and you have time capsule that store your backup, chances are you may want to restore your time capsule backup to your new mac. In my situation, I have a time capsule backup of over 300GB, which the restore size is very big. If you tried to restore your backup from: WiFi: Even if you are putting your mac very close to time capsule, the file transfer rate may vary largely, and sometimes even got timeout.  In my case it can range from 2b/second (not KB, but bytes) to 15.1MB/second. Cable / Ethernet: I am using a USB Type C - Gigabytes Ethernet cable to connect to each other.  While the file transfer rate is very stable, but it is also slow.  The average is 1MB/second.  But it may take over 150 hours (in my case).  My solution is to use a USB to USB-C (Type C) cable connection: on the back of time capsule there is a USB port, and you can use that cable to connect your time capsule and mac.  In my case I am ...

AWS XRay PHP generate trace_id and id

 Code below to generate `trace_id` and `id` that are required in `putTraceSegments()` function if you are using AWS XRay: Example: $trace_id = sprintf( '%s-%s-%s', '1', dechex( (int)time() ), bin2hex( openssl_random_pseudo_bytes(12)) ); $trace_seg = array(     'id' => bin2hex(openssl_random_pseudo_bytes(16)),     'name' => 'TestName_'.date("YmdHis"),     'trace_id' => $trace_id,     'start_time' => microtime(true),     'end_time ' => date("U", strtotime('now + 10 seconds') )      // 'in_progress' => true, ); Reference: AWS putTraceSegments() documentation

AWS Load Balancer return 502/504 Error & (possible) solution

Are you facing a 502 Bad Gateway problem from your AWS load balancer, while your web server return value successfully? If so, please read on. Here is my situation: - I am using Wordpress 5.8 as backend service - In WP admin panel we create a PHP function that make an AJAX request, which then called another WP functions, and get JSON string as return. - But this WP admin panel is behind an AWS Load balancer, which means the URL points to AWS LB first, and the values will be transferred back-and-forth between LB - WP. Here is the problem:  When we make an AJAX request, LB returns 502 Bad Gateway in our testing server.  But there is no problem in local development server. Here is why this problem exists: - First of all, this is NOT a timeout problem.   - We tested that web server can handle up to 2 mins long request.  But even if the request just use 7 seconds, it will still return 502.  So setting Keep-alive(timeout) and other server timeout did not work. htt...

[Solved] Big File Size: Cannot upload file through Nginx Error 500

Reference: https://ofstack.com/Nginx/17070/nginx-upload-file-size-error-500-solution.html TL:DR; Add `client_body_buffer_size 100M;` in nginx.conf, besides client_max_body_size, then restart nginx. --  The symptoms are as follow: We have an Nginx server that routes traffic to internal Wordpress CMS When user uploads file through media page in WP, only file in small size (< 10K) can be uploaded, while file with large size (e.g. > 1M and <= 2M) cannot be uploaded. The error is: "Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels." Strictly speaking, this is a PHP image library error, not WP error.  You cannot find this error in WP source code WP is hosted on Apache server. PHP post size, max size is setting to 80M (or any other large values) in php.ini. Nginx client client_max_body_size is set to 10M (or any other large value) No erro...

[SEO] How Wordpress load a post withPermalink / Pretty URL?

It is crucial to know how WP loads your URL in terms of SEO Here is how it works Assume that we have a URL like this:  http://my_domain/jw萬豪酒店加送多項婚宴優惠/ When Wordpress (v5.4) first load your post, the files are loaded like this: - /index.php, then load - /wp-blog-header.php And wp-blog-header.php called a function called wp(), which leads to the following code: public function main( $query_args = '' ) { $this->init(); $this->parse_request( $query_args ); $this->send_headers(); $this->query_posts(); $this->handle_404(); $this->register_globals(); /** * Fires once the WordPress environment has been set up. * * @since 2.1.0 * * @param WP $this Current WordPress environment instance (passed by reference). */ do_action_ref_array( 'wp', array( &$this ) ); } Now if you add log: public function main( $query_args = '' ) { $this->init(); $this->parse_request( $query_args ); $this->send_headers(); ...

地藏菩薩本願經大字版,適合手機觀看讀誦

Image
適合手機觀看的地藏經 各位好。 小弟有於工作日誦地藏經的習慣。唯網上版的PDF於手提電話中誦讀甚為困難。故特此重新設計此經。 經文以凈空法師專集網站整理的經文為藍本。 經文PDF在此 。 除了把字型加大,更把斷句重新編排以配合閱讀習慣。 以下是PDF版下載連結(Mediafire.com)可供參考: 請按此 。 如有任何意見,歡迎留言。

中文SEO 2019: Title及Meta Description 長度

Image
Title長度: 38個中文字 (全形標點符號被視為1個中文字) Meta Description長度: 73個中文字 (全形標點符號被視為1個中文字) 我見過有74個中文字的meta description, 所以長度該是73-74個.

[Solved] Unrecognized input file format --- perhaps you need -targa

In short, in case you encounter cjpeg error: Unrecognized input file format --- perhaps you need -targa, you can use the command below. Assume that your JPG image file is source.jpg: [root@server ~]# djpeg source.jpg | cjpeg -quality 65 -progressive -optimize -outfile source65.jpg Rename the source file as backup, rename the optimize file to be the one to load. [root@server ~]# mv source.jpg source.jpg.bak; mv source65.jpg source.jpg Hope it helps someone. Thank you.

百日築基

在道家氣功的修煉中,入門後的第一個階段便是築基階段。亦稱:“百日築基” 所謂築基,顧名思義就是打地基的意思。大家都知道,高樓大廈平地起,關鍵在於打好地基,地基打好了才能蓋起大樓來,倘若地基不固,即便蓋好大樓也會傾於一旦。 道家氣功的修煉,猶如蓋大樓一樣,也需要築基,這裡指的築基主要是兩個方面:一是要以所選功法的要求,在明師的指點下,以堵漏失;二是用精、血化氣後形成的體內真氣(生命能量),去疏通、修補身體的病變。 也有部分門派將煉精化氣也歸到築基部分,這是要求比較高的了。 年未滿16、童身未破者,精氣神三全,不需要進行命功修煉,可以直接進行高層性功的修行。 1、堵漏: 男、女性進入青春發育期後,都會出現正常的生理現像,男會遺精,女有月經。這在道家養生學中稱之為“身漏”,即稱“漏身之體”。精與血為人體生命的“至寶”,也是人類繁衍生息的根本。但繁衍生息男無須天天走、女不該月月失。然人類生性貪圖享樂,更戀床地之歡,固造成生命能量的浪費,使元氣走失、疾病叢生而不能怡享天年。故歷來修道仙術的第一步便是“百日築基”即“補缺堵漏”。道家先師呂洞賓所講的“順則凡、逆則仙,只在中間顛倒顛”便是此意。 初習者往往咬文嚼字地去理解氣功術語,以為百日築基,就是一百天完成,其實這裡所指的“百日”並非百天的意思,而是以百日來形容需要較長的時間來完成的意思。 至於到底需要多少天來築基堵漏,這與所選的功法、有無明師指點、練功時的入境程度、每天所化的練功時間、及每個人不同的身體狀況等諸多因素有密切的關聯,無統一標准可循,更不是修煉者的主觀願望所能決定的。 2、修補 所謂修補,指的是修補已漏之身。這裡所指的已漏之身,並不是單純指走精與漏血,主要是指由於體內元氣的走失,造成真氣(生命能量)不足所引起的各種病變。因此,一般人認為未婚男女是童子身、練功無須百日築基的看法無疑是偏面的。 二、關於氣機運行 在醫療氣功(大部分是道家築基功演化而來)靜功的修習中,大部分學員在築基階段,都要經歷得氣、行氣、疏通和衝擊四個過程。 1、得氣 道家氣功的修習,一般通常從“命功”入手,”所謂命功,即築基功。而築基功的下手功夫一般都在下丹田開始,修煉者首先會感受到練功時腹內腸子蠕動增強,頻放矢氣(屁)繼而出現丹田發熱、小腹發熱等得氣現像。 2、行氣 隨著修煉者自身“...

[Suggested Solution] Failed to set session cookie. Maybe you are using HTTP instead of HTTPS

TL;DR: look at your .htaccess file and see if there are any HTTPS related config enabled.  If yes, disable it. First, please take a look at this issue (Open new window) . In my case, I have a production HTTPS site, while my local development site is just HTTP. However, since you want your files between development and production are as synchronized as possible, you may not aware that your .htaccess file (assume using Apache), may be the problem. In my .htaccess, I have these lines: # https://geekflare.com/apache-web-server-hardening-security/#21-Remove-Server-Version-Banner <IfModule mod_headers.c> # You can replace "PHP" with "-" to completely hide your PHP version Header set X-Powered-By "PHP" # If HTTPS Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure # If HTTP # Header edit Set-Cookie ^(.*)$ $1;HttpOnly; </IfModule> Please note that the #If HTTPS is in effect now, but this may affect your se...

佛頂尊勝陀羅尼咒 2019

南無    巴嘎瓦帝    德來路戈呀    巴拉帝    偉施司大呀    布達呀    巴嘎瓦帝    達地呀它    唵    偉須達呀    偉須達呀    薩瑪薩瑪    司曼達    瓦巴薩    司把拉那    嘎帝    嘎哈那    索巴瓦    威須爹    阿比森    恰圖曼    蘇嘎它    瓦拉瓦恰那    阿米里達    比曬該    瑪哈曼德拉    巴戴    阿哈拉    阿哈拉    阿又索    達拉尼    須達呀    須達呀    嘎嘎那    威須爹    屋司尼薩    偉加呀    威須爹    薩哈司拉    拉司米    三處抵爹    薩而瓦    達它嘎達    瓦羅卡尼    沙特巴拉米達    巴里布羅尼    薩爾瓦    達它嘎達    賀里達呀    帝施達那    帝施抵爹    瑪哈目德烈    鎢針拉嘎呀    三哈達那    威須爹    薩爾瓦    瓦拉那...

Facebook Messenger Chatbot: Using NodeJS Fetch function and New Line

Here is the code: const PAGE_ACCESS_TOKEN = "your_long_FB_page_access_token" let my_return_answer = 'my answer<br>another answer' // Construct the message body let request_body = { "recipient": { "id": senderID // This value coming from webhook_event.sender.id }, "message": { "text": my_return_answer.replace(/<br>/g, "\r\n") } } fetch("https://graph.facebook.com/v2.6/me/messages/?access_token=" + PAGE_ACCESS_TOKEN, { method: "POST", body: JSON.stringify(request_body), headers: { 'Content-Type': 'application/json', }, }).then((res) => res.json()) .then((fb_json) => { console.log({fb_json}) }) - If you are using NodeJS fetch function, please use the above code as reference - To display new blank line in FB messenger bot, use \r\n as above. Hope it helps.

[Solved] Wordpress Change User/Admin Email without confirmation/verification

If you see a notice when you update your user email address (not just admin) in Wordpress, and you want to disable it, below is the How-To to fix this problem. When you change your email address, you may see     There is a pending change of your email to <some_email_address.> To solve, in your theme functions.php, add this line ( Reference Link here ):     remove_action( 'personal_options_update', 'send_confirmation_on_profile_email' ); Saved and upload to your theme directory.  Fixed! By the way, in case you want to disable email notification after changing your password, add the following line in your theme functions.php ( Reference Link here )     add_filter( 'send_password_change_email', '__return_false' ); Saved and upload to your theme directory.  Fixed! Hope it helps someone.

How to use ntpd to setup and sync Hong Kong Time From Gov 2018

Image
First install NTP using: yum install -y ntpd (CentOS) or sudo apt install -y ntpd (Ubuntu) Edit the ntp config file.  Under CentOS it is /etc/ntp.conf Find the section where it shows: server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst Comment it out (Adding # at the beginning of each line): # server 0.centos.pool.ntp.org iburst # server 1.centos.pool.ntp.org iburst # server 2.centos.pool.ntp.org iburst # server 3.centos.pool.ntp.org iburst Add the following line (as of 10 Dec 2018 from pool.ntp.org).  No need to put # at the beginning.  For latest server list please go to:  https://www.ntppool.org/zone/hk server stdtime.gov.hk prefer server 2.hk.pool.ntp.org server 2.asia.pool.ntp.org server 0.asia.pool.ntp.org Save the file and exit. Final output: Stop the service first:  systemctl stop ntpd.service After stopping the service, trigger ...

How To Edit Paypal.me Business Description in Paypal?

Image
To people who have difficulties in finding where is the place to edit your Paypal.me business description and other settings, here is the step by step method with screenshots (Text in Chinese, but the concept should be the same): - Go to Tools > Request for payment (Yes it is super stupid!) - On the bottom right hand corner, you can see (Manage your Paypal.Me Profile) - Click on the top left hand corner "Manage Your Profile":  Info hidden for security purpose. - In your Paypal.me profile, click the "Update" link beside your personal message. - Finally, edit your info and save! One of the most stupid thing is this: you cannot edit your paypal.me profile while clicking the gear icon on top right.  You cannot find any link that allows you to edit your Paypal.me description. There are other stupid thing also: it is difficult to find out where to manage your periodic payments also ( I know where it is finally after searching on Google!)....

香港銀行編號/代碼及分行編號/代碼一覽表 2019

若各位想查詢香港所有銀行及分行編號的列表,請下載由 香港銀行同業結算有限公司網頁 的列表: XLS - 按此下載 PDF - 按此下載 或直接到 該公司的網頁 查詢。

[Solved] CodeIgniter/CI 3 - 404 Page not found (with or without subdirectory) problem

Check the following if you have 404 Page Not Found error when you deploy your CI application to Linux, while there is no problem under MS Windows. Check if your controller file name and class name inside that file have identical (not ONLY the same, but Identical) name.  For example, if your controller class name is MyController, your controller file name must be: MyController.php.  mycontroller.php does not work, Mycontroller.php does not work.  It MUST BE MyController.php, identical to class name MyController. Hope it helps.

[Solved]LiveAgent (LADesk) Rules HTTP Request What is inside HTTP Body?

Image
In short, if you don't know what should be put inside the HTTP Body field when you are using HTTP request as rules, here is the string that contains " Everything ". Just copy and paste the below code to your HTTP Body box and you will get everything sent from LA to your URL. ---- Start Here ------- initiator_id={$initiator_id}&initiator_username={$initiator_username}&initiator_firstname={$initiator_firstname}&initiator_lastname={$initiator_lastname}&last_in_ticket_agent_id={$last_in_ticket_agent_id}&last_in_ticket_agent_username={$last_in_ticket_agent_username}&last_in_ticket_agent_firstname={$last_in_ticket_agent_firstname}&last_in_ticket_agent_lastname={$last_in_ticket_agent_lastname}&conv_last_message={$conv_last_message}&conv_code={$conv_code}&conv_conversationid={$conv_conversationid}&conv_datecreated={$conv_datecreated}&conv_datechanged={$conv_datechanged}&conv_datedue={$conv_datedue}&conv_priority={$...

Microsoft BotFramework - Why my image not show on FB?

One of the reason is because MS BotFramework is assuming you to use HTTPS for everything (link especially). So if your message outgoing link is not HTTPS, you may not be able to show the image in your FB messenger. Hope it helps someone.

Parsley.js - zh_HK/zh_CN is not available in the catalog

If you encounter: zh_HK is not available in the catalog or zh_CN is not available in the catalog error when you use caldera form under wordpress, or using it in standalone application, the problem is that parsley.js will load zh_HK.js (or zh_CN.js) in the web page.  However, in the i18n directory, there is no zh_HK.js. Even worst, for TW and CN language, the file name is zh_tw.js and zh_cn.js. And even more worst, inside zh_cn.js the name 'zh-cn' is used. So to solve this problem, here are what I have done: Duplicate a new file using "Save As..." from zh_tw.js to zh_HK.js Open zh_HK.js, change zh-hk to zh_HK Rename zh_cn.js to zh_CN.js Open zh_CN.js, change zh-cn to zh_CN There will be no more javascript error. Hope it helps. Thank you.