BCS Generate Yii View

Because Yii is one of the fastest and most reliable PHP frameworks I use it for many web based projects.  From time to time I was required to create a new view files for Yii.  I decided to use a Delphi application to generate the Yii view file.  Then I modified that code to generate multiple Yii Views based on values in a collection or list of strings.

When the Clone View option is selected the following dialog appears to collect the view name from the user.


Once the name is supplied the the user is then prompted to select an output folder.


Once the output folder is selected the user the view file is generated and the application is ready for the next view to be generated or to exit the application.

Output from our example may be reviewed below.

/* @var $this yii\web\View */
use yii\helpers\Html;
$this->title = 'About Test';
$this->params['breadcrumbs'][] = $this->title;
<div class="site-about">
    <h1><?= Html::encode($this->title) ?></h1>
        This is the About Test page. You may modify the following file to customize its content:
    <code><?= __FILE__ ?></code>


Notice the application removes all spaces from the page name and uses that page name as the file name.  The “.php” extension is also added to the file name for acceptable usage.

When I selected the Multiple Views Option the following dialog appears.


Type in as many view names as desired.  For each view name listed a complete view will be created in the target sub directory.

Either click the x on the dialog or select the Exit option on the Primary Options Menu to terminate execution of dialog.  The next dialog will identify the output location or views folder for the new views.


Should a view exist in the output location the following dialog will appear.


Since that file exists no output is attempted.  This application will not overwrite views.  Processing will resume with the next item in the list.

If you are not a Delphi developer you can still use this tool by following these instructions.

Establish a directory structure “C:\dev\w32\2016\BCSGenView” (minus double quotes).  Next create a “skel” sub directory (minus double quotes).  The input file is listed below.  The file name should be “about.php” (minus double quotes).

/* @var $this yii\web\View */
use yii\helpers\Html;
$this->title = 'About';
$this->params['breadcrumbs'][] = $this->title;
<div class="site-about">
    <h1><?= Html::encode($this->title) ?></h1>
        This is the About page. You may modify the following file to customize its content:
    <code><?= __FILE__ ?></code>

Go back to the “C:\dev\w32\2016\BCSGenView” sub directory and create a “xqt” sub directory (minus double quotes) and place the downloaded executable 32 or 64 bit there.  Execute the program in the “xqt” sub directory and enjoy.

A 32 bit executable program may be downloaded by clicking here.
A 64 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Ubuntu Internet Server

There are those times when you are required to produce an active internet server to support delivery of web content and relational database management systems services.  My first choice is the Ubuntu headless server.  This server allows enough flexibility to support Apache, Java, Grails, Ruby on Rails, PHP, Yii, Action Message Format (AMF) Flash Builder and Flex,  (32 and 64 bit) thin client windows application and dot net web application servers. The RDBMS of choice is MySQL.  The significance of using this approach is that it supports thin client windows application to become conversant with MySQL.  This thin client does not require any additional middle ware layer such as ODBC or any other layer.

Another advantage of using Ubuntu is it supports practically all known web technologies and practically all domain specific languages (DSL).

On occasions I develop end user applications on the windows platform and the port them to the server via a web archive (WAR) file where Tomcat 8 application server hosts the allows access to the end user application.

tomcat 8

On other occasions I develop shell scripts to invoke the desired commands which builds the application.  This is typically used for Grails and Ruby On Rails applications.  Also shell scripts are useful whenever a series of shell command need to be executed for various purposes.

Normally when I develop software the Eclipse IDE is the IDE of choice.  There are those occasions when I use Delphi to develop 32 and 64 bit windows and OS X applications.  Plus Delphi has the environment to develop all the mobile and tablet applications in a single platform development environment.

Webmin is a windows based GUI that provides a vehicle to perform almost all the system administration tasks required to keep your server current.

web admin base
Below is a screen shot of the File Manager of Webmin.

webmin file manager

Below is an example of the editor for Webmin.

webmin edit

Putty a secured shell server that is also used to handle other server administration tasks.  The primary difference between Putty and Webmin is the lack of a GUI for issuing commands.  Putty is strictly a command line shell.


The secure connection employed by Putty offers a peace of mind and a sense of security for an environment as powerful as the command environment.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Install Eclipse Mars SDK

There are those times when you would like to install the Eclipse Software Development Kit (SDK) Integrated Development Environment (IDE). The Eclipse SDK project’s code name is Mars. I have chosen Mars because it supports all Domain Specific Languages (DSL), PHP and practically all the mobile interfaces in a single IDE. The MVC approach is supported nicely in all programming development environments under Mars SDK. This article makes you aware of the dependencies and pitfalls of installing the Eclipse SDK IDE.

First install the Java Development Kit (JDK). The Java Runtime Environment (JRE) is not sufficient for successful Eclipse invocation. Eclipse SDK IDE will not function without at lease one JDK installed. This approach will work until the desired results are not attained. Troubleshooting begins when the desired functionality is not produced. Typically there is nothing to troubleshoot at this point.

The next step would be to install the Eclipse SDK. This lightweight SDK IDE footprint will allow the developer the most flexibility for a software development IDE.

To install Grails first install the Eclipse Marketplace Client.

Once the Eclipse SDK is installed click on the “Help” menu item. Then select the “Install New Software” sub menu item. At the next dialog be sure to select “All Available Sites” option on the first drop-down.

ecl inst

Traverse to the “General Purpose Tools” and left click the selector to view its children. You will notice “Marketplace Client” towards the end of the list. Left click to check it (to be installed) then click the “Next Button” and follow the prompts. This will install the “Marketplace Client”.

Once the “Marketplace Client” is in place click “Help”. Select “Eclipse Marketplace” and when the dialog appears type “Grails” in the Find (search) box of the Market Place Client dialog.

ecl mp

Select the “Install” Option of the most recent Groovy / Grails Tool Suite available. Follow the prompts to successfully install the Grails nature to the Eclipse SDK.

To install the PHP nature to the Eclipse SDK IDE click on the “Help” menu item. Then select the “Install New Software” sub menu item. At the next dialog be sure to select “All Available Sites” option on the first drop-down. Traverse to the “Programming Languages” and click the control on the left to reveal its children. Near the end of the list you will see the “PHP Development Tools (PDT)”. Select that item for installation then click the “Next” control near the bottom of the dialog and simply follow the remaining prompt to install the PHP nature to the Eclipse SDK IDE.

ecl php

By following these simple instructions you have just enabled the Grails and PHP perspectives / nature to the Eclipse SDK IDE. Your IDE is second to none for these two software development environments as well as other perspectives you may install or activate.

You may proceed to add other natures/perspectives to the Eclipse SDK IDE as you deem necessary. Eclipse Mars can accommodate practically all of your computer software development requirements.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Wampserver 64 Bit

When installing Wampserver on the Windows 8.1 (64 bit) and the Windows 10 (64 bit) be sure and use the 64 bit version of Wampserver. Depending on the platform Wampserver will advise you of any missing software.

The first thin to do is make sure the localhost designation is not commented in the hosts file of the operating system. The hosts file on the windows platform is usually found at C:\Windows\System32\drivers\etc\hosts. Care should be taken to open the file you will perform the edit with in administrator mode. Anything less than administrator mode not be able to save any required changes.

After successful install make sure services are installed for Apache and MySQL. Start all service should be invoked after these two services are installed.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Yii Populate Array With Database Content

To fetch an array containing database values the Yii active record facility offers a nifty solution for achieving the desired overall effect.

$sql = 'SELECT * FROM slnk t order by t.lkn';
$query = Yii::app ()->db->createCommand ( $sql )->queryAll ();
foreach ( $query as $row ) {           
         // Include statements to generate here

There is no need for external connection modules or adding other files to the MVC stack, Yii handles it all for you. When you change databases none of this code requires updating.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Eclipse Mars IDE

Well folks Eclipse has done it again. The newest release Mars is available. I have used Mars for the first three milestones and I could not be more pleased. I initially downloaded the Eclipse Mars M3 Packages beginning with the IDE for Java EE Developers. The initial install can be located at the link below.

Of course I install the 64 bit version of Eclipse. To make the spelling checker function properly make sure the JDT plugin is installed. The Eclipse Java Development Tools houses the engine for the spell checker.

Install Grails and the associated servers via the Eclipse Marketplace. Be sure to use the latest version. This option give you a nice Java development stack.

Be sure to install the PHP Development Tool (PDT). This feature allows me to program all things PHP like WordPress, Yii, CodeIgniter and other PHP applications.

The tool plugin continue with installing c++, Ruby, Tcl/Tk and Python to round out the development stack.

Since this is the 64bit stack the FlashBuilder plugin will not function properly in a 64 bit stack. A separate 32 bit stack of Eclipse is used to support FlashBuilder.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Eclipse Luna SDK 4.4

The new Eclipse SDK Luna became available earlier last month and of course I procured a 64 bit copy and began tailoring it for production use.

Python 3.x is enabled flawlessly for utilization of all Python applications.

Groovy and Grails Tool Suite (GGTS) 3.4.0, Grails 2.3.6, Groovy 2.1.9, JVM 1.7.0_11 mixed mode, jquery 1.11.0, groovy pages 2.3.6 and hibernate round out the grails development environment.

Php applications such as Yii 1.1.13 are also ready for service.

C, c++ Java, Ruby on Rails, FORTRAN, COBOL and HTML 5 interfaces are in place and ready for service.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Eclipse Juno

Today I had the opportunity to download and install Eclipse Juno (SDK 4.2.0). I was pleasantly surprised at the improvements made with Eclipse.

Of course for all my PhP and Java development I use the 64 bit version. There are some major development tools I use that do not support the 64 bit environment so I also installed the 32 bit version of Juno to support those efforts.

I am now programming multiple languages and dialects within the Eclipse environment. I recommend the Eclipse environment for your development efforts.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

Read File Contents YII PhP

There are those occasions when an entire file (text or HTML) must be read from a file and stored in a variable for subsequent use. The following code snippet outlines a function to accomplish the aforementioned premise.  Notice the “$fna” parameter.  This parameter  would contain the file name of the file to be processed.  The function returns a variable that contains the entire contents of the file.

function ReadHtml($fna)
			$fh = fopen($fna, 'r');
			$theData = fread($fh, filesize($fna));
			return $theData;

The calling sequence would resemble the following:

$bod = ReadHtml(Yii::app()->basepath . ‘/views/sig.html’);

The HTML file “sig.html” is located in the “views” sub directory.  The “$bod” variable now contains the file contents entirely.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Yii’s Pear Considerations For Test Driven Development (TDD)

Verify correct installation of pear by invoking a command prompt and typing pear and the following output should appear in the command.

build                  Build an Extension From C Source
bundle                 Unpacks a Pecl Package
channel-add            Add a Channel
channel-alias          Specify an alias to a channel name
channel-delete         Remove a Channel From the List
channel-discover       Initialize a Channel from its server
channel-info           Retrieve Information on a Channel
channel-login          Connects and authenticates to remote channel server
channel-logout         Logs out from the remote channel server
channel-update         Update an Existing Channel
clear-cache            Clear Web Services Cache
config-create          Create a Default configuration file
config-get             Show One Setting
config-help            Show Information About Setting
config-set             Change Setting
config-show            Show All Settings
convert                Convert a package.xml 1.0 to package.xml 2.0 format
cvsdiff                Run a "cvs diff" for all files in a package
cvstag                 Set CVS Release Tag
download               Download Package
download-all           Downloads each available package from the default channel
info                   Display information about a package
install                Install Package
list                   List Installed Packages In The Default Channel
list-all               List All Packages
list-channels          List Available Channels
list-files             List Files In Installed Package
list-upgrades          List Available Upgrades
login                  Connects and authenticates to remote server [Deprecated in favor of channel-login]
logout                 Logs out from the remote server [Deprecated in favor of channel-logout]
makerpm                Builds an RPM spec file from a PEAR package
package                Build Package
package-dependencies   Show package dependencies
package-validate       Validate Package Consistency
pickle                 Build PECL Package
remote-info            Information About Remote Packages
remote-list            List Remote Packages
run-scripts            Run Post-Install Scripts bundled with a package
run-tests              Run Regression Tests
search                 Search remote package database
shell-test             Shell Script Test
sign                   Sign a package distribution file
svntag                 Set SVN Release Tag
uninstall              Un-install Package
update-channels        Update the Channel List
upgrade                Upgrade Package
upgrade-all            Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]
Usage: pear [options] command [command-options] <parameters>
Type "pear help options" to list all options.
Type "pear help shortcuts" to list all command shortcuts.
Type "pear help <command>" to get the help for the specified command.

If you encounter problems getting the above information to appear you will have to begin debugging to determine why the application is improperly configured.

One place to start is Google for installation of your version of PhP.

After the pear installation is verified traverse to the Yii installation where pear is installed and key in the phpunit command. The following output should appear in the command session.

PHPUnit 3.6.4 by Sebastian Bergmann.
Usage: phpunit [switches] UnitTest [UnitTest.php]
       phpunit [switches] <directory>
  --log-junit <file>        Log test execution in JUnit XML format to file.
  --log-tap <file>          Log test execution in TAP format to file.
  --log-json <file>         Log test execution in JSON format.
  --coverage-clover <file>  Generate code coverage report in Clover XML format.
  --coverage-html <dir>     Generate code coverage report in HTML format.
  --coverage-php <file>     Serialize PHP_CodeCoverage object to file.
  --coverage-text=<file>    Generate code coverage report in text format.
                            Default to writing to the standard output.
  --testdox-html <file>     Write agile documentation in HTML format to file.
  --testdox-text <file>     Write agile documentation in Text format to file.
  --filter <pattern>        Filter which tests to run.
  --group ...               Only runs tests from the specified group(s).
  --exclude-group ...       Exclude tests from the specified group(s).
  --list-groups             List available test groups.
  --loader <loader>         TestSuiteLoader implementation to use.
  --printer <printer>       TestSuiteListener implementation to use.
  --repeat <times>          Runs the test(s) repeatedly.
  --tap                     Report test execution progress in TAP format.
  --testdox                 Report test execution progress in TestDox format.
  --colors                  Use colors in output.
  --stderr                  Write to STDERR instead of STDOUT.
  --stop-on-error           Stop execution upon first error.
  --stop-on-failure         Stop execution upon first error or failure.
  --stop-on-skipped         Stop execution upon first skipped test.
  --stop-on-incomplete      Stop execution upon first incomplete test.
  --strict                  Run tests in strict mode.
  -v|--verbose              Output more verbose information.
  --skeleton-class          Generate Unit class for UnitTest in UnitTest.php.
  --skeleton-test           Generate UnitTest class for Unit in Unit.php.
  --process-isolation       Run each test in a separate PHP process.
  --no-globals-backup       Do not backup and restore $GLOBALS for each test.
  --static-backup           Backup and restore static attributes for each test.
  --bootstrap <file>        A "bootstrap" PHP file that is run before the tests.
  -c|--configuration <file> Read configuration from XML file.
  --no-configuration        Ignore default configuration file (phpunit.xml).
  --include-path <path(s)>  Prepend PHP's include_path with given path(s).
  -d key[=value]            Sets a php.ini value.
  -h|--help                 Prints this usage information.
  --version                 Prints the version and exits.
  --debug                   Output debugging information.

If there is difficult reaching this screen debugging should begin with Google for the version of Pear installed.

Once you are successful displaying these  your installation is properly configured to continue Test Driven Development (TDD) with Yii.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.