Paul's Programming Notes     Archive     Feed     Github

Easyphp Change Directory To Github

1. Right click on the easyphp icon --> configuration --> apache (this should open the httpd.conf in your easyphp apache directory)

2. Find the section labelled DocumentRootDirectory and overwrite with this:

# DocumentRootDirectory
<Directory "C:/Users/your_username/Documents/GitHub/your_project/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted

</Directory>

Setting Up Github Windows Client Behind a Proxy

1. Navigate to your git.exe directory (C:\Users\your_username\AppData\Local\GitHub\PortableGit~\bin)

2. git config --global http.proxy http://username:password@host:port/

3. git config --system http.sslcainfo /bin/curl-ca-bundle.crt

4. Open the github client (it should work now)

move_uploaded_file To Current Path - PHP

$uploadfile = './' . basename($_FILES['file']['name']);

if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
echo "File was successfully uploaded.\n";
} else {
echo "There was an issue uploading the file.\n";
}

View In Use and Will Not DROP - MySQL

I had several views in my MySQL database that were showing "In Use" and phpmyadmin would not let me drop them through the interface.

The solution:
Open the MySQL in terminal and "DROP VIEW yourView;"

Include Array From File - PHP

file.php
<?php
return array('item1','item2');
?>

Your php code:

<?php
$thisVariable = include('file.php');
print_r($thisVariable); //prints the array
?>

Don't Use Nested IFNULL, Use COALESCE - MySQL

If you're looking for how to do a nested IFNULL, you probably need to be looking at how to use COALESCE instead. It returns the first non-null item in a list.

Example:
SELECT COALESCE(NULL,1);

Returns 1

IFNULL - MySQL

IFNULL(`field1`, `field2`)

That returns field1 if it's not null. However, it will return field2 if it is null.

Notes On JOIN - MySQL


  • If your INNER join is returning too few values and duplicates, you're probably using the wrong kind of join. Try a LEFT join.
  • INNER JOIN is the same as JOIN
  • http://i.stack.imgur.com/GbJ7N.png (diagram explaining joins)
  • LEFT JOIN is used - this will return ALL rows from Table1, regardless of whether or not there is a matching row in Table2. 

Indexes Help... A Lot

I just brought 4 queries from 15 seconds to less than 1 second by adding indexes to the columns in the ON() portion on the join.

Indexes help... A lot.