CodeIgniter base project

If you are starting a CodeIgniter project, I’d recommend using

as your base.  Composer makes things so much easier.  Then for User management and authentication use Ion_Auth (GitHub)

If you need LDAP, Adldap2 is really easy to use.

From the kenji github page, you can find a lot of other packages.  The other package I’ve used a lot of is the REST Server.  However, if all you need to do is a REST Server I’d recommend using NodeJS.


Posted in Coding, php | Tagged , , | Leave a comment

Selectize.js onInit load data for autocomplete

Selectize.js is a neat UI tool.  I got introduced to it via a coworker used it in a project.  I didn’t bother to really look into it until recently when I wanted to do autocomplete and multiple selects.

I didn’t find any example code of using the onInit option to load values via a Remote API so I decided to make an example to share with you all.

Code is here on my github,,

Example can be seen here on my DigitalOcean server.

Posted in Coding, Web | Tagged , , | Leave a comment


Finally signed up for DigitalOcean’s services.  I chose them more because I like the How To articles they have to help one get up and running.  You can get a better deal with Linode but I wanted to support DigitalOcean cause they’ve helped me.  Plus I’m not doing anything (yet) that is very server intensive.

I’ll probably move my personal websites onto there.


Posted in Web | Leave a comment

CodeIgniter3 .htaccess removing index.php subdomain

Below is the general documentation for editing the .htaccess file to remove index.php from a url

The documentation examples is
will be the same as

using .htaccess file of:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

However, I tend to use a lot of subdomains of the format

To remove index.php from a subdomain is a bit different, you need to add an additional line to .htaccess

RewriteBase /website1/


RewriteBase /website2/

The .htaccess file should be:

RewriteEngine On
RewriteBase /SUBDOMAIN/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Another interesting Codeigniter Project I found last weekend was

I was having some issues with the controller not finding the libraries i put in the third_part folder.  I had the include path correct to the library and it worked on my localhost but wouldn’t work on the server.  I couldn’t figure out the issue and instead used the above project and that worked with no issues on localhost and the server.

Posted in Coding, Web | Tagged , , , | Leave a comment


Went to the SoCal Linux Expo today.  First time attending and it was pretty neat.  I went to the Reactor8 guys talks/workshop.  Didn’t know anything they were talking about at first but eventually got an idea of their talks.  Beginning of their talks was a Puppet and CHEF. Basically configuration management for virtual instances.  Then later talk was about Docker swarm and  serverless (AMZ lambda).  My notes are on the other computer.

Posted in Linux | Tagged , , | Leave a comment

Time to relearn a new skill: Spark

I took a Spark class maybe earlier this year but can’t say I really remember any of it.  Figured I’ll just start at the beginning with an Intro to Spark class on


These days just developing an excel like webpage using handsontable.  Not very interesting at all.

Posted in Coding, Web | Leave a comment

Clash Royale Card Calculator

I play Clash Royale and decided to make a card calculator to calculate what level troops I would have with all my cards and how much gold it would cost.  I don’t upgrade all of the troops because who has enough gold for that?

I’m debating whether I want to make a mobile app for this.  On my github page I have the project hosted there too.

Here it is:


Posted in App Idea | Leave a comment

TCPDF: Open Source PHP Class for generating PDF documents.

Been using TCPDF the last couple of days and have to say it is real easy to use.  The examples are really easy to follow and then customize to one’s own needs.

Really easy to format the PDF using the table type format of using the function Cell() and MultiCell().  Only tricky thing about MultiCell is if the cell’s content is multiple lines.  You have save the output of MultiCell() (returns number of rows used) and then add that many lines after (ln(output)).  If you don’t do it you will have cells on top of the multicell.

$numRows = $this->MultiCell()

Haven’t gotten around to using the barcode but that’s probably what I’ll be looking at in the future.

Posted in Coding, Web | Tagged | Leave a comment

ADOdb library

Came across this today. Well saw someone use this library. seems pretty neat to check out more later.  Been writing my own SQL code for PHP scripts. Think this library can make this easier and generate part of it I believe

Posted in Coding | Tagged , | Leave a comment

Google Geocoding API Example in PHP

I had to quickly create a script to set the latitude and longitude value in a DB knowing the address.

I googled and found this site that explained the basics of how to use the Google Geocoding API.

I decided to expand on his example and create a script that shows one how to get the individual address components and save them in an associative array.  Saving them in an associative array makes it a bit cleaner.  I guess a better way can be to save it in a class and use get functions for the cleanest solution.  I’ll leave that to the next person.  Here is my example on my github page.


$addr = "1600 Pennsylvania Avenue, 20500";

$result = geocode($addr);


echo "The full address is: ".  $result['formatted_address'] 
." with latitude: ".$result['lat'] ." and longitude: ".$result['lon']." \n";

// function to geocode address, it will return false if unable to geocode address
function geocode($address){
    // url encode the address
    $address = urlencode($address);
    // google map geocode api url
    $url = "{$address}";
    // get the json response
    $resp_json = file_get_contents($url);
    // decode the json
    $resp = json_decode($resp_json, true);
    // response status will be 'OK', if able to geocode given address 
        // get the important data
		$street_number = NULL;
		$street_name = NULL;
		$city_name = NULL;
		$county_name = NULL;
		$state_name = NULL;
		$state_abbr = NULL;
		$country_name = NULL;
		$country_abbr = NULL;
        $lati = $resp['results'][0]['geometry']['location']['lat'];
        $longi = $resp['results'][0]['geometry']['location']['lng'];
        $formatted_address = $resp['results'][0]['formatted_address'];
		$address_components = $resp['results'][0]['address_components'];
		foreach ($address_components as $component) {
			$type = $component['types'][0];
			if ($type == 'street_number')
				$street_number = $component['short_name'];
			else if ($type == 'route')
				$street_name = $component['short_name'];
			else if ($type == 'locality')
				$city_name = $component['short_name'];
			else if ($type == 'administrative_area_level_2')
				$county_name = $component['short_name'];
			else if ($type == 'administrative_area_level_1') {
				$state_name = $component['long_name'];
				$state_abbr = $component['short_name'];
			else if ($type == 'country') {
				$country_name = $component['long_name'];
				$country_abbr = $component['short_name'];
			else if ($type == 'postal_code')
				$postal_code = $component['short_name'];
        // verify if data is complete
        if($lati && $longi && $formatted_address){
            // put the data in the array
            $data_arr = array();   

			$data_arr['street_number'] = $street_number;
			$data_arr['street_name'] = $street_name;
			$data_arr['city_name'] = $city_name;
			$data_arr['county_name'] = $county_name;
			$data_arr['state_name'] = $state_name;
			$data_arr['state_abbr'] = $state_abbr;
			$data_arr['country_name'] = $country_name;
			$data_arr['country_abbr'] = $country_abbr;
			$data_arr['lat'] = $lati;
			$data_arr['lon'] = $longi; 
			$data_arr['formatted_address'] = $formatted_address;
            return $data_arr;
            return false;
        return false;




Posted in Uncategorized | Leave a comment