Posts

Showing posts from 2021

Inkscape DXF to SVG on Linux and Windows Command line solution

Assume that I am converting truelove5.dxf to truelove5.svg in an A4 size canva. Windows : Notes: Use the python version inside inkscape (bin\python.exe) Use dxf_input.py in C:\Program Files (x86)\inkscape\share\inkscape\extensions\. Use --scalemethod=auto to do autoscale. You can open this .py file directly in your text editor to see how it works inside. Assume that my main inkscape program is installed in C:\Program Files (x86)\inkscape\, inside this directory, execute: bin\python.exe share\inkscape\extensions\dxf_input.py c:\Users\myuser\truelove5.dxf --output=c:\Users\myuser\truelove5.svg --scalemethod=auto You should be able to open this new svg file in a browser just by doubleclick it. Linux: Notes: Surprisingly complicated I am running this under AWS EC2.  Adjust your environment accordingly Reference:  https://superuser.com/a/1389548/909624 , read Third method, type 2 Steps Download the AppImage in main Inkscape site ( https://inkscape.org/release/inkscape-1.1.1/gnulinux/ ) Uplo

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 connecting my mac using USB-C, and USB

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. https://medium.com/jalexs-murmur

[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 error logs WP