Blog

Java Runtime Environment (JRE) is a software package that contains what is required to run a Java program; such as Netbeans and DBeaver
[Wikipedia]

Note: If you can, install the latest executable JRE, which will give you the option to keep the Java JRE auto updated.

But if due to your company’s security policies, you are not be able to update to the latest required Java JRE or even install the Java JRE executable (exe), you can often download and use the portable versions of programs, often distributed as zip, tar, or gz files.

Or maybe you just want a portable and easy to backup version of the Java JRE.

To run Java programs with the latest Java JRE, download the Java Platform, Standard Edition (Java SE), Runtime Environment.

Download the latest version of Java JRE




Java SE Runtime Environment 10 Downloads
http://www.oracle.com/technetwork/java/javase/downloads/jre10-downloads-4417026.html
Download the jre-10.0.1_windows-x64_bin.tar.gz file (as of this post)

Note: If you are on a 32bit OS, you will have to download the Java JRE version 8, as versions 9, 10 and later no longer support 32bit OSes.

Java SE Runtime Environment 8 Downloads
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Download the jre-8u172-windows-i586.tar.gz file for 32bit OSes or 
Download the jre-8u172-windows-x64.tar.gz file for 64bit Oses

Extract the tar.gz file to a directory, such as
C:/Portable/Java/jre1.8.0_161/
Or
C:/Portable/Java/jre-10.0.1/

Note: BandiZip is a good free archive (zip) program






As an alternative, and if you can install exe files, you can try jPortable.
jPortable allows you to create a full-featured Java Runtime Environment





Run the downloaded
jPortable_8_Update_161_online.paf.exe




Choose an installation directory, which may be a USB drive.
The default installation directory is 
C:\PortableApps\CommonFiles\Java



And wait for the program to download the actual Java JRE.



You now have a portable version of Java. 
But to use it, you will often have to configure your programs to point to your portable Java directory.
So remember where you installed the Java JRE

C:/Portable/Java/jre1.8.0_161/
Or
C:\PortableApps\CommonFiles\Java

Note: You can also add these paths to your Environment Variables
Details can be found in this Stackoverflow post
https://stackoverflow.com/a/1672536


Configure portable Netbeans to use portable Java JRE

Configure portable DBeaver to use portable Java JRE



End of document. Thanks for reading.

Simple PHP console output helper.

While using PHPUnit, you may want to output or debug your tests.

Normal echo/print_r/dump only outputs after PHPUnit's output, if at all.

Using ConsoleOutput will echo inline with PHPUnits output,

giving you a better context of your output/debugging.

Usage:

$this->consoleOutput = new ConsoleOutput();

$this->consoleOutput->showWarning('test showWarning');

test showWarning

View on GitHub

Simple PHP formatter for bytes

Usage:

$this->formatSize = new FormatSize();

$bytes = 4398046511104;
$decimals = 2;
$formatted = $this->formatSize->formatBytes($bytes, $decimals);
$this->assertEquals('4.00 TB', $formatted); 

View on GitHub
Ubuntu 16.04 Xenial
Serve PHP7 using PHP7-fpm and Apache 2.4

By default, in Ubuntu 16.04 Xenial, installing the packages for PHP, PHP-fpm, and Apache does not result in a working php website. 

The extra configuration required follows:

Install Apache2
> sudo apt-get -y install apache2

Install php, with some common packages
> sudo apt-get -y install php php-cli php-mbstring php-gd php-mcrypt php-pgsql php-mysql php-xml php-curl php-intl

Create your own apache vhost config
> vi /etc/apache2/sites-available/vhosts
<VirtualHost *:80>
    ServerName tutorial.localhost   
DocumentRoot /path/to/tutorial/web   
SetEnv APP_ENV "dev"   
<Directory /path/to/tutorial/web>       
AllowOverride All       
Require all granted #<-- 2.4 New configuration   
</Directory>
</VirtualHost>

Enable your vhost config
> sudo a2ensite vhosts

Disable the defualt config
> sudo a2dissite 000-default

And the missing parts of conflagration:

Enable php7-fpm
> sudo a2enconf php7.0-fpm

Enable rewrite so frameworks such as Symfony, Zend, Larvel, etc work with 'pretty' urls
enable proxy so apache can send php requests to php7-fpm
> sudo a2enmod rewrite proxy proxy_fcgi

And restart apache
> sudo systemctl restart apache2

PHP should be working now

> vi /path/to/webroot/phpinfo.php
<?php
phpinfo();

End of document. Thanks for reading.