Archive for the ‘Uncategorized’ Category

Test

Posted: July 1, 2022 in Uncategorized

https://docs.learning.moe.edu.sg/sls/index.html

React+Material-UI

Posted: July 10, 2019 in Uncategorized

I have been playing around of React recently and found this superb https://material-ui.com/, which provides a lot of widgets for you to add to your React app.

It reminds me of the old days when I first saw Bootstrap. It empowered developers to develop fantastic UI without wasting time with slices from photoshop-only designers. Material-UI with React makes it better.

With React and Material-UI, i managed to revamp my small website over one weekend. Check it out here: http://www.twomoms.sg

The code is working fine in local development, however, when deployed to production, it will return 404 when directly accessing a url managed by React Router.

The reason is because the server doesn’t understand the url and it’s managed by React Router in the client side. The simplest solution is to change your server configuration to redirect all request to index.html.

For example, in Apache .htaccess

RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

Socket connections uses file descriptor and it’s limited.

For Ubuntu, you can ulimit -a to see the current limit. (ulimit is not a binary command, so that no need sudo)

To increase the openfile to a maximum limit of 4096, you can ulimit -n 4096.

More than 4096 must edit the system file /etc/security/limits.conf.

In the current terminal, you will need su to make the settings take effect.

Turn off secure boot in your BIOS.

and then

sudo apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox

I have been using Amzon Cloud Drive to back up all my personal videos, but i noticed recently that many of my videos have a date taken as NO DATE or 1970.

After some research, i found the answer in this post. Amazon Cloud Drive seems to read the date from some video tags instead of the file creation date.

I wrote the below windows batch script to set those tags based on file creation date. The script is based on a system date format mm/dd/yyyy hh:ii tt.

@ECHO OFF

SET filename="c:\your\video\file.mp4"

for %%a in (%filename%) do set filedatetime=%%~ta

ECHO %filedatetime%

set month=%filedatetime:~0,2%
set day=%filedatetime:~3,2%
set year=%filedatetime:~6,4%
set hour=%filedatetime:~11,2%
set minute=%filedatetime:~14,2%
set second=00
set pm=%filedatetime:~17,2%

if "%pm%" == "PM" (
set /a hour=1%hour%-100+12
)

if "%hour%" == "24" (
set /a hour=12
)

set finaldatetime="%year%:%month%:%day% %hour%:%minute%:%second%"

ECHO %finaldatetime%
:: set finaldatetime="2014:07:12 21:32:00"

exiftool %filename% -filecreatedate=%finaldatetime%
exiftool %filename% -filemodifydate=%finaldatetime%
:: exiftool %filename% -fileaccessdate=%finaldatetime%
exiftool %filename% -createdate=%finaldatetime%
exiftool %filename% -modifydate=%finaldatetime%
exiftool %filename% -trackcreatedate=%finaldatetime%
exiftool %filename% -trackmodifydate=%finaldatetime%
exiftool %filename% -mediacreatedate=%finaldatetime%
exiftool %filename% -mediamodifydate=%finaldatetime%