User Tools

Site Tools


blog

Hugo and PHP for building Websites

I built almost all my websites using PHP. Recently, I started to build simple HTML sites using Hugo, which was amazing. However, occasionally, I missed the flexibility of PHP for server side processing. I have tried to output PHP files instead of html files from Hugo but was not successful. Eventually, I resolved to make the change to the web server instead. Basically, one can change the setting of the server to parse .html files as php files. Several ways can be used. For example, one can use .htaccess with the following

AddType application/x-httpd-php .html

One can also change the configure file to add the option for the directory.

Now, I can use Hugo together with PHP.

2021/06/19 18:06 · johnny · 0 Comments · 0 Linkbacks

Flatten comments in Acrobat Pro

Bring up the Preflight tool (search preflight), then use the “Flatten annotations and field” in the “PDF Fixups” (search flatten) category.

2019/09/24 10:51 · johnny · 0 Comments · 0 Linkbacks

Quantify the impact of your R packages

Software development often takes a lot of time but its impact is often difficult to evaluate. If you have developed an R package and upload it to CRAN, you might be able to get some download information but not a lot.

Since R studio hosts the CRAN mirror, it keeps tracking the download statistics of the R packages installed from the RStudio mirror and therefore provides some useful information. It also provides an R package -cranlogs- to get the information within R. Certainly, the information is not incomplete but at least it provides the developers some ideas on how their packages are used.

For example, the code below is used to get the download information in the past month of an R package coefficientalpha I developed.

library(cranlogs)

cran_downloads('coefficientalpha', when='last-month')

         date count          package
1  2019-04-08    15 coefficientalpha
2  2019-04-09    15 coefficientalpha
3  2019-04-10    25 coefficientalpha
4  2019-04-11    18 coefficientalpha
5  2019-04-12    25 coefficientalpha
6  2019-04-13    13 coefficientalpha
7  2019-04-14    11 coefficientalpha
8  2019-04-15    22 coefficientalpha
9  2019-04-16    15 coefficientalpha
10 2019-04-17    31 coefficientalpha
11 2019-04-18    11 coefficientalpha
12 2019-04-19    19 coefficientalpha
13 2019-04-20    14 coefficientalpha
14 2019-04-21    14 coefficientalpha
15 2019-04-22    19 coefficientalpha
16 2019-04-23     6 coefficientalpha
17 2019-04-24    21 coefficientalpha
18 2019-04-25    19 coefficientalpha
19 2019-04-26     7 coefficientalpha
20 2019-04-27    11 coefficientalpha
21 2019-04-28    13 coefficientalpha
22 2019-04-29    38 coefficientalpha
23 2019-04-30    14 coefficientalpha
24 2019-05-01    18 coefficientalpha
25 2019-05-02    18 coefficientalpha
26 2019-05-03    10 coefficientalpha
27 2019-05-04     3 coefficientalpha
28 2019-05-05    15 coefficientalpha
29 2019-05-06    58 coefficientalpha
30 2019-05-07    39 coefficientalpha
2019/05/08 15:55 · johnny · 0 Comments · 0 Linkbacks

Apache log process using GoAccess

sudo zcat /var/log/apache2/access-advstats.*.gz | sudo goaccess /var/log/apache2/access-advstats.log -o report.html --log-format=COMBINED
2019/03/04 09:41 · johnny · 0 Comments · 0 Linkbacks

regex

Replace $abc$ with $`abc`$:

\$([^$]*)\$

\$`\1`\$

Replace 4. 5 with 4.5

(\d)[.]\s+(\d)

$1.$2


([a-zA-Z])[.]([a-zA-Z])
$1. $2
2018/11/03 23:48 · johnny · 0 Comments · 0 Linkbacks

Older entries >>

Blog History


Note. Everything on this blog only reflects my personal view which may or may not be true and is not related to any organization or institute.


Page Tools