Determine the date of a webpage

There is often a need to use a webpage as a reference. So how is it possible to get the most recent date that webpage was updated?

There have been people suggesting that one might exploit the power of google and execute a specific kind of search that might reveal the date of a webpage. Like using the “inurl” trick<webpage>

To my understanding, this trick is either outdated, or does not apply in all cases, as unfortunately in my case.

I found out that there is another trick that actually works. This includes a bit of JavaScript magic and access to the DOM, specifically the lastModified property of the document. The trick goes like this:

  1. Normally open the webpage on a browser
  2. Go to the address bar and type in the following javascript command and hit enter

It is expected that the browser will respond with an alert box presenting the exact latest update date and time for this webpage.

*** Although Chrome and Firefox checked ok, currently there is an issue with Safari which refuses to execute a JavaScript command from the address bar (nowadays called the “smart search field”).

Apparently there is a workaround: Enable “Allow JavaScript on Smart Search Field” in the “Develop” menu of Safari (this menu is activated from Safari Preferences > Advanced)


A basic step-by-step Linux shell-based web server installation

The following set of shell commands are among the basic steps to setup a Linux-based web server (LAMP=Linux Apache MySQL PHP). The procedure has been tested on an Ubuntu 14.04.05 Trusty Tahr (LTS) installation. Most steps and procedures are based on the tutorial found in DigitalOcean and in the linked pages.

In the commands that follow variables are shown as tags in angle brackets, like: <username>.

  1. Enable ssh root access
  2. This might be needed if there is no remote ssh access (only web console or local).

    nano /etc/ssh/sshd_config
    # then change: PermitRootLogin yes
    # and then restart SSH:
    service ssh restart

  3. Create sudo user
  4. This is a useful user account with elevated privileges.

    adduser <username>
    usermod -aG sudo <username>

    It might be a good idea to log in with this user account and continue…

  5. Install Apache-MySQL-PHP
  6. # make sure everything is updated.
    sudo apt-get update
    # install Apache
    sudo apt-get install apache2
    # install MySQL
    sudo apt-get install mysql-server php5-mysql
    # create MySQL data structure
    sudo mysql_install_db
    # secure the MySQL installation
    sudo mysql_secure_installation
    # install PHP5
    sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
    # change the default file extension
    sudo nano /etc/apache2/mods-enabled/dir.conf
    # move the index.php at front of the list of filenames to load
    sudo service apache2 restart

  7. Install PhpMyAdmin
  8. # install phpmyadmin package
    sudo apt-get install phpmyadmin apache2-utils
    # edit the configuration file
    sudo nano /etc/apache2/apache2.conf
    # insert: Include /etc/phpmyadmin/apache.conf
    # and then restart the server one more time...
    sudo service apache2 restart
    # edit the apache configuration file of phpmyadmin
    sudo nano /etc/phpmyadmin/apache.conf 
    # add: AllowOverride All
    # just after: DirectoryIndex index.php
    # then create the .htaccess file
    sudo nano /usr/share/phpmyadmin/.htaccess
    # with the following contents
    AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile /etc/apache2/.phpmyadmin.htpasswd
    Require valid-user
    # and now create the htpasswd file
    sudo htpasswd -c /etc/apache2/.phpmyadmin.htpasswd <username>
    # ...and restart the server one more time.
    sudo service apache2 restart

  9. Create SSL certificate on Apache
  10. # enable SSL
    sudo a2enmod ssl
    sudo service apache2 restart
    # create folder to save the keys and certificates
    sudo mkdir /etc/apache2/ssl 
    # create a self-signed SSL certificate that will expire in <days> days
    sudo openssl req -x509 -nodes -days <days> -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
    # set up the certificate
    sudo nano /etc/apache2/sites-available/default-ssl.conf
    # insert: 
    ServerName <server_name_or_IP>:443
    # just below the ServerAdmin email entry
    # also change SSLCertificateFile field to: 
    # also change SSLCertificateKeyFile field to: 
    # enable the virtual host
    sudo a2ensite default-ssl
    sudo service apache2 reload

  11. Install the FTP service
  12. sudo apt-get install vsftpd
    sudo nano /etc/vsftpd.conf
    # make sure to have: 
    # check if needed to change: 
    sudo service vsftpd restart

  13. Give folder access of apache web server files to the user
  14. sudo apt-get install acl
    # give <username> access to the html folder
    sudo setfacl -m u:<username>:rwx /var/www/html

The result will be a basic setup running LAMP. The best way to access the files is through SFTP. The browsers will have HTTPS access (but the certificate will be self-signed, so the browsers will complain about it).

Additional/optional steps that might be handy

Unix user manipulation and www-data
#Add a new user to the www-data group
sudo useradd -g www-data <username>
sudo passwd <username>
#Add a new user to supplementary groups called www-data and ftp:
sudo groupadd <username>
sudo useradd -g <username> -G www-data,ftp <username>
sudo passwd <username>
#Add an existing user called <username> to the www-data group:
sudo usermod -a -G www-data  <username>
#And check it:
id <username>
groups <username>
WordPress-specific tweak
#Shell command to give correct access to WordPress and be able to install plug-ins and themes (and have updates)
chown -R www-data:www-data /var/www
chmod -R ug+rw /var/www



you are the mighty surfer
taming the waving of the sea,
but you are a glorious shimmering blob,
a single little bubble,
a transparent, refracting prism,
just hovering,
sometimes even touching
upon a wave
of an obscure origin
and flattening dark end

of what was before
and what comes next,
of things and nothings
and ideas and beliefs,
but there are only possibilities,
probabilities that collapse into necessities
a chaos ordered, determined of
uncertain origins or rhythms,
tangents upon curvatures of spaces and times
of worlds centuries apart and inches close
yet never close enough to contact,
non-perceivable assumed dimensions
under the constant cry of the eternal light

you exit to where there is no exit
just to look at what’s inside
and build more bubbles out in the nowhere
not to feel alone in the dark,
but this transforms nothing to something
by this simple given thought
and then you run back into symmetries
for a meaning all in all,
on a stage of equal weights
on which singulars are stars


Differentiation cheat sheet

This post serves as a cheat sheet for differentiation. It just includes the most basic of the rules to be remembered when computing derivatives. First a little reminder on the notation being used in differentiation.

Leibniz’s notation for the first derivative of a function f(x) is
\displaystyle \frac{\mathrm{d}f(x)}{\mathrm{d}x}

Newton’s notation for the first derivative of a function f(x) is
\displaystyle \dot{f}

Lagrange’s notation for the first derivative of a function f(x) is
\displaystyle f^\prime(x)

Euler’s notation for the first derivative of a function f(x) is
\displaystyle D_xf(x)

These notations are being used interchangeably and each seems to be more appropriate for some special cases, in which the mathematical expression becomes ‘clearer’ or ‘beautiful’.

In the following differentiation cheat sheet I am going to use Newton’s notation.

Constant \displaystyle f(x) = c \Rightarrow \dot{f} = 0
Constant times a function \displaystyle f(x) = c \cdot u(x) \Rightarrow \dot{f} = c \cdot \dot{u}
Power \displaystyle f(x) = x^n \Rightarrow \dot{f} = nx^{n-1}
Constant times a power \displaystyle f(x) = c \cdot x^n \Rightarrow \dot{f} = cnx^{n-1}
Sum of functions \displaystyle f(x) = u(x)+v(x) \Rightarrow \dot{f} = \dot{u} + \dot{v}
Product of functions \displaystyle f(x) = u(x) \cdot v(x) \Rightarrow \dot{f} = v \dot{u} + u \dot{v}
Quotient of functions \displaystyle f(x) = \frac{u(x)}{v(x)} \Rightarrow \dot{f} = \frac{v \dot{u}-u\dot{v}}{v^2}
Chain rule \displaystyle f(x) = u(v(x)) \Rightarrow \dot{f} = \dot{v} \cdot \dot{u}(v)
Chain rule special \displaystyle f(x) = [u(x)]^2 \Rightarrow \dot{f} = n[u(x)]^{n-1}\dot{u}
Exponent \displaystyle f(x) = e^{u(x)} \Rightarrow \dot{f} = \dot{u}e^{u(x)}
Exponent special \displaystyle f(x) = e^x \Rightarrow \dot{f} = f(x) = e^x
Logarithic \displaystyle f(x) = \ln{u(x)} \Rightarrow \dot{f} = \frac{\dot{u}}{u}
Logarithmic spacial \displaystyle f(x) = \ln{x} \Rightarrow \dot{f} = \frac{1}{x}

Let’s try to derive the extremely powerful differentiation method described in a previous post.

In that post it was stated that the derivative of a function of the form
\displaystyle f = k \cdot u^a \cdot v^b \cdots
with k a constant and with respect to an independent variable x, is simply,
\displaystyle \dot{f} = f \cdot \left [ a \frac{\dot{u}}{u} + b \frac{\dot{v}}{v} + \cdots \right ]

Let us consider the simplest case, in which
\displaystyle f = k \cdot u^a \cdot v^b

with a little bit of mixing (primarily) of the product rule and the chain rule we get,
\displaystyle \dot{f} = k (v^b \dot{u^a} + u^a \dot{v^b}) \\ = k (v^b a u^{a-1}\dot{u} + u^a b v^{b-1}\dot{v})

but is is easy to see that from the original function,
\displaystyle f = k \cdot u^a \cdot v^b \Rightarrow f = k \cdot (u^{a-1}u) \cdot v^b \Rightarrow v^b u^{a-1} = \frac{f}{ku}

and similarly,
\displaystyle f = k \cdot u^a \cdot v^b \Rightarrow f = k \cdot u^a \cdot (v^{b-1}v) \Rightarrow u^a v^{b-1} = \frac{f}{kv}

Why do we need these two? simply because they showed up in the previous expression, in which we got stuck (momentarily), thus,
\displaystyle \dot{f} = k \left[ a \frac{f}{ku} \dot{u} + b \frac{f}{kv} \dot{v} \right] = k \frac{f}{k} \left[ a \frac{\dot{u}}{u} + b \frac{\dot{v}}{v} \right] = f \left[ a \frac{\dot{u}}{u} + b \frac{\dot{v}}{v} \right]