<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'>
	<channel>
		<title>Epigroove</title>
		<description>The home of web designer and developer, Jamie Tibbetts.</description>
		<link>http://www.epigroove.com/</link>
		<language>en-us</language>

					<item> 
				<title>How to Fix PHP SLIR from throwing 404 - File not found errors</title>
				<description>If you are using &lt;a href=&quot;https://github.com/lencioni/SLIR&quot;&gt;SLIR&lt;/a&gt;, and you're getting 404 errors, it probably means &lt;span class=&quot;mono&quot;&gt;mod_rewrite&lt;/span&gt; isn't working. And the reason it's not working is probably your apache &lt;span class=&quot;mono&quot;&gt;httpd.conf&lt;/span&gt; file not allowing the &lt;span class=&quot;mono&quot;&gt;.htaccess&lt;/span&gt; file in the &lt;span class=&quot;mono&quot;&gt;/slir/&lt;/span&gt; directory to override it.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Step 1:&lt;/b&gt; Check to make sure SLIR works using the query method.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;code&gt;
&lt;img src=&quot;/slir/?w=200&amp;amp;i=/path/to/image.jpg&quot;&gt;
&lt;/code&gt;

&lt;p&gt;If using the query method works, you know SLIR is working correctly.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Step 2:&lt;/b&gt; Check to confirm that the following doesn't work:&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;code&gt;
&lt;img src=&quot;/slir/w200/path/to/image.jpg&quot;&gt;
&lt;/code&gt;

&lt;p&gt;If using the method in Step 2 doesn't work, &lt;span class=&quot;mono&quot;&gt;mod_rewrite&lt;/span&gt; is to blame.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Step 3:&lt;/b&gt; Open your apache &lt;span class=&quot;mono&quot;&gt;httpd.conf&lt;/span&gt; file and look for a relevant &lt;span class=&quot;mono&quot;&gt;&amp;lt;Directory&amp;gt;&lt;/span&gt; for your website.&lt;/p&gt;

&lt;p&gt;Change this:&lt;/p&gt;

&lt;code&gt;
AllowOverride None
&lt;/code&gt;

&lt;p&gt;To this:&lt;/p&gt;

&lt;code&gt;
AllowOverride All
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;Step 4:&lt;/b&gt; Restart apache, and you should be good to go!&lt;/p&gt;</description>
				<link>http://www.epigroove.com/blog/how-to-fix-php-slir-from-throwing-404-file-not-found-errors</link>
				<pubDate>Sat, 15 Nov 2014 14:37:20  CDT </pubDate>
				<guid isPermaLink="false">Epigroove124</guid>
			</item>			
					<item> 
				<title>Solve the UI Bootstrap modal error: Failed to load template</title>
				<description>&lt;p&gt;Are you getting the following error when attempting to use a &lt;a href=&quot;http://angular-ui.github.io/bootstrap/#/modal&quot;&gt;UI Bootstrap modal dialog&lt;/a&gt; in your AngularJS project?&lt;/p&gt;

&lt;code&gt;
Failed to load template: template/modal/backdrop.html
&lt;/code&gt;

&lt;p&gt;Make sure you're linking to the UI Bootstrap library with the templates included (i.e. &lt;span class=&quot;mono&quot;&gt;ui-bootstrap-tpls.js&lt;/span&gt;) and not the plain UI Bootstrap library (i.e. &lt;span class=&quot;mono&quot;&gt;ui-bootstrap.js&lt;/span&gt;).&lt;/p&gt;

&lt;code&gt;
&lt;script src=&quot;//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js&quot;&gt;&lt;/script&gt;
&lt;/code&gt;</description>
				<link>http://www.epigroove.com/blog/solve-the-ui-bootstrap-modal-error-failed-to-load-template</link>
				<pubDate>Sun, 23 Feb 2014 11:25:17  CDT </pubDate>
				<guid isPermaLink="false">Epigroove123</guid>
			</item>			
					<item> 
				<title>UI Bootstrap not loading in AngularJS</title>
				<description>&lt;p&gt;If you're adding &lt;a href=&quot;http://angular-ui.github.io/bootstrap/&quot;&gt;UI Bootstrap&lt;/a&gt; to your AngularJS project, and you're getting an &quot;angular is not defined&quot; and/or &quot;Failed to instantiate module ui.bootstrap&quot; error, make sure you are including the &lt;span class=&quot;mono&quot;&gt;ui-bootstrap.js&lt;/span&gt; script file &lt;strong&gt;after&lt;/strong&gt; the &lt;span class=&quot;mono&quot;&gt;angular.js&lt;/span&gt; script file in your html.

&lt;code&gt;
&lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;//ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap.js&quot;&gt;&lt;/script&gt;
&lt;/code&gt;</description>
				<link>http://www.epigroove.com/blog/ui-bootstrap-not-loading-in-angularjs</link>
				<pubDate>Sun, 23 Feb 2014 10:18:17  CDT </pubDate>
				<guid isPermaLink="false">Epigroove122</guid>
			</item>			
					<item> 
				<title>Using user-defined MySQL variables in Laravel</title>
				<description>&lt;p&gt;I attempted to do the following in Laravel:&lt;/p&gt;

&lt;code&gt;
DB::query(&quot;SET @rank:=0; UPDATE scores SET rank=@rank:=@rank+1 WHERE game_id=4 ORDER BY score DESC&quot;);
&lt;/code&gt;

&lt;p&gt;That is valid MySQL code, and works if you type it directly into MySQL via the command line, but Laravel was throwing an error:&lt;/p&gt;

&lt;code&gt;
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version for the right 
syntax to use near 'UPDATE scores SET rank=@rank:=@rank+1 WHERE game_id=4 ORDER BY' at line 1

SQL: SET @rank:=0; UPDATE scores SET rank=@rank:=@rank+1 WHERE game_id=4 ORDER BY score DESC

Bindings: array (
)
&lt;/code&gt;

&lt;p&gt;I attempted to separate the two queries:&lt;/p&gt;

&lt;code&gt;
DB::query(&quot;SET @rank:=0&quot;);
DB::query(&quot;UPDATE scores SET rank=@rank:=@rank+1 WHERE game_id=4 ORDER BY score DESC&quot;);
&lt;/code&gt;

&lt;p&gt;But Laravel still threw an error:&lt;/p&gt;

&lt;code&gt;
Method [] is not defined on the Query class.
&lt;/code&gt;

&lt;p&gt;&lt;span class=&quot;mono&quot;&gt;DB::raw()&lt;/span&gt; to the rescue!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;code&gt;
DB::query(DB::raw(&quot;SET @rank:=0&quot;));
DB::query(&quot;UPDATE scores SET rank=@rank:=@rank+1 WHERE game_id=4 ORDER BY score DESC&quot;);
&lt;/code&gt;</description>
				<link>http://www.epigroove.com/blog/using-user-defined-mysql-variables-in-laravel</link>
				<pubDate>Wed, 01 May 2013 16:49:44  CDT </pubDate>
				<guid isPermaLink="false">Epigroove121</guid>
			</item>			
					<item> 
				<title>&quot;General error: 1005 Can't create table&quot; using Laravel</title>
				<description>&lt;p&gt;If you're getting the following error when attempting to run a migration, you might be trying to add a foreign key on a parent field that doesn't exist yet.&lt;/p&gt;

&lt;pre&gt;
SQLSTATE[HY000]: General error: 1005 Can't create table 'posts.#sql-XXXX' (errno: 150)

SQL: ALTER TABLE `comments` ADD CONSTRAINT comments_post_id_foreign FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE cascade ON UPDATE cascade
&lt;/pre&gt;

&lt;p&gt;In the above example migration, the &lt;span class=&quot;mono&quot;&gt;comments&lt;/span&gt; table is being created before the &lt;span class=&quot;mono&quot;&gt;posts&lt;/span&gt; table, and a foreign key that references the &lt;span class=&quot;mono&quot;&gt;id&lt;/span&gt; field in the &lt;span class=&quot;mono&quot;&gt;posts&lt;/span&gt; table is attempting to be added. But since the &lt;span class=&quot;mono&quot;&gt;posts&lt;/span&gt; table doesn't exist yet, it's resulting in an error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Make sure the &lt;span class=&quot;mono&quot;&gt;Schema::create()&lt;/span&gt; calls are in the right order, i.e. &lt;span class=&quot;mono&quot;&gt;Schema::create('posts')&lt;/span&gt; has to come before &lt;span class=&quot;mono&quot;&gt;Schema::create('comments')&lt;/span&gt;.&lt;/p&gt;

&lt;pre&gt;
Schema::create('posts', function($table) {
    $table-&gt;increments('id');
    ...
});

Schema::create('comments', function($table) {
    $table-&gt;increments('id');
    $table-&gt;integer('post_id')-&gt;unsigned()-&gt;index();
    ...
    $table-&gt;foreign('post_id')-&gt;references('id')-&gt;on('posts')-&gt;on_update('cascade')-&gt;on_delete('cascade');
});
&lt;/pre&gt;

&lt;p&gt;If your &lt;span class=&quot;mono&quot;&gt;Schema::create()&lt;/span&gt; calls are in separate migration files, you just need to change the order in which the files are processed during the migration. To do so, change the timestamp values in the names of the migration files so that the files get run in the correct chronological order.&lt;/p&gt;

&lt;pre&gt;
2013_04_14_&lt;strong&gt;233507&lt;/strong&gt;_create_posts.php
2013_04_14_&lt;strong&gt;233508&lt;/strong&gt;_create_comments.php
&lt;/pre&gt;

&lt;p&gt;Then, when you run &lt;span class=&quot;mono&quot;&gt;php artisan migrate&lt;/span&gt;, the &lt;span class=&quot;mono&quot;&gt;create_posts&lt;/span&gt; migration file will be processed before the &lt;span class=&quot;mono&quot;&gt;create_comments&lt;/span&gt; migration file.&lt;/p&gt;</description>
				<link>http://www.epigroove.com/blog/general-error-1005-cant-create-table-during-laravel-migration</link>
				<pubDate>Sun, 14 Apr 2013 10:31:31  CDT </pubDate>
				<guid isPermaLink="false">Epigroove120</guid>
			</item>			
					<item> 
				<title>Laravel routes not working? Make sure .htaccess is working.</title>
				<description>&lt;p&gt;If your Laravel routes aren't working, and you're getting &amp;quot;Not Found&amp;quot; errors whenever you try and load a page, your &lt;span class=&quot;mono&quot;&gt;.htaccess&lt;/span&gt; file is likely lacking permission to do its duty.&lt;/p&gt;

&lt;p&gt;The key is the apache &lt;span class=&quot;mono&quot;&gt;&lt;a href=&quot;http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride&quot;&gt;AllowOverride&lt;/a&gt;&lt;/span&gt; directive.&lt;/p&gt;

&lt;p&gt;If you don't have &lt;span class=&quot;mono&quot;&gt;AllowOverride&lt;/span&gt; set to &lt;span class=&quot;mono&quot;&gt;All&lt;/span&gt;, your Laravel &lt;span class=&quot;mono&quot;&gt;.htaccess&lt;/span&gt; file (&lt;span class=&quot;mono&quot;&gt;/public/.htaccess&lt;/span&gt;) won't be able to enable &lt;span class=&quot;mono&quot;&gt;mod_rewrite&lt;/span&gt;, and your routes won't work.&lt;/p&gt;

&lt;p&gt;The first step is to open your apache &lt;span class=&quot;mono&quot;&gt;httpd.conf&lt;/span&gt; file. In OS X, it is located at:&lt;/p&gt;

&lt;code&gt;
/private/etc/apache2/httpd.conf
&lt;/code&gt;

&lt;p&gt;&lt;strong&gt;Option 1) Modify your main &amp;lt;Directory&amp;gt; directive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will change the &lt;span class=&quot;mono&quot;&gt;AllowOverride&lt;/span&gt; value for all your websites. In your &lt;span class=&quot;mono&quot;&gt;httpd.conf&lt;/span&gt; file, look for the main &lt;span class=&quot;mono&quot;&gt;&amp;lt;Directory&amp;gt;&lt;/span&gt; directive:&lt;/p&gt;

&lt;code&gt;
&lt;Directory &quot;/var/www/html&quot;&gt;
    ...
    AllowOverride None
    ...
&lt;/Directory&gt;
&lt;/code&gt;

&lt;p&gt;Simply change it to this:&lt;/p&gt;


&lt;code&gt;
&lt;Directory &quot;/var/www/html&quot;&gt;
    ...
    AllowOverride All
    ...
&lt;/Directory&gt;
&lt;/code&gt;

&lt;p&gt;&lt;strong&gt;Option 2) Add a &amp;lt;Directory&amp;gt; directive to your site's &amp;lt;VirtualHost&amp;gt; directive.&lt;/strong&gt;&lt;/p&gt;

&lt;code&gt;
&lt;VirtualHost 127.0.0.1:80&gt;
    DocumentRoot &quot;/var/www/html/epigroove/public&quot;
    ...
    &lt;Directory &quot;/var/www/html/epigroove/public&quot;&gt;
        AllowOverride All
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;
&lt;/code&gt;

&lt;p&gt;Save the changes to your &lt;span class=&quot;mono&quot;&gt;httpd.conf&lt;/span&gt; file, restart or reload apache, and your routes should be up-and-running.&lt;/p&gt;</description>
				<link>http://www.epigroove.com/blog/laravel-routes-not-working-make-sure-htaccess-is-working</link>
				<pubDate>Sun, 03 Mar 2013 13:32:26  CDT </pubDate>
				<guid isPermaLink="false">Epigroove119</guid>
			</item>			
					<item> 
				<title>PHP Undefined index: extension</title>
				<description>&lt;p&gt;If you ever get the PHP error &lt;span class=&quot;mono&quot;&gt;Undefined index: extension&lt;/span&gt;, it's most likely because a filename that has no extension is being passed to the &lt;span class=&quot;mono&quot;&gt;&lt;a href=&quot;http://php.net/pathinfo&quot;&gt;pathinfo()&lt;/a&gt;&lt;/span&gt; function.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;code&gt;
$filename = &quot;/images/company_logo&quot;;
$parts = pathinfo($filename);
echo $parts['extension'];
&lt;/code&gt;
&lt;p&gt;Result:&lt;/p&gt;

&lt;code&gt;
Undefined index: extension
&lt;/code&gt;

&lt;p&gt;The filename must contain an extension, because &lt;span class=&quot;mono&quot;&gt;pathinfo()&lt;/span&gt; gets the extension from the name of the file, not from the file itself. The file doesn't even have to exist; &lt;span class=&quot;mono&quot;&gt;pathinfo()&lt;/span&gt; doesn't care.&lt;/p&gt;

&lt;p&gt;Working example:&lt;/p&gt;

&lt;code&gt;
$filename = &quot;/images/company_logo.png&quot;;
$parts = pathinfo($filename);
echo $parts['extension'];
&lt;/code&gt;

&lt;p&gt;Result:&lt;/p&gt;

&lt;code&gt;
png
&lt;/code&gt;</description>
				<link>http://www.epigroove.com/blog/php-undefined-index-extension</link>
				<pubDate>Sun, 24 Feb 2013 11:32:12  CDT </pubDate>
				<guid isPermaLink="false">Epigroove118</guid>
			</item>			
					<item> 
				<title>GoDaddy, mod_rewrite, and Preview DNS</title>
				<description>&lt;p&gt;&lt;strong&gt;WARNING: Most mod_rewrite rules do not work when previewing a site hosted on GoDaddy.com!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you are testing out a website using GoDaddy's &quot;Preview DNS&quot; feature (e.g. http://domain.com.previewdns.com/), do not expect mod_rewrite rules in your .htaccess file to work. I could only get very basic catch-all rules to work. All other rules resulted in 404 errors.&lt;/p&gt;

&lt;p&gt;After much frustration, a GoDaddy representative confirmed what I suspected:&lt;/p&gt;

&lt;blockquote&gt;&quot;The mod_rewrite is able to function on the hosting plan. However, due to the dependency of the URL, for the rewrite to function, the Preview DNS may not allow it to function properly. If the rewrite is coded properly then it will function once the website is made fully live through our hosting plan.&quot;&lt;/blockquote&gt;

&lt;p&gt;So I guess the solution is to cross your fingers and hope that your rules are set up correctly.&lt;/p&gt;

&lt;p&gt;I hope this saves someone else a headache.&lt;/p&gt;</description>
				<link>http://www.epigroove.com/blog/godaddy-modrewrite-and-preview-dns</link>
				<pubDate>Tue, 14 Aug 2012 00:00:00  CDT </pubDate>
				<guid isPermaLink="false">Epigroove117</guid>
			</item>			
					<item> 
				<title>Use PHP to count number of files in a directory</title>
				<description>&lt;p&gt;Here's a simple bit of PHP code to get the total number of files in a directory using the &lt;span class=&quot;mono&quot;&gt;glob()&lt;/span&gt; and &lt;span class=&quot;mono&quot;&gt;count()&lt;/span&gt; functions:&lt;/p&gt;

&lt;code&gt;
$num_files = count(glob($_SERVER['DOCUMENT_ROOT'].'/path/to/directory/*'));
&lt;/code&gt;

&lt;p&gt;Or here's how to only count files with a .jpg extension:&lt;/p&gt;

&lt;code&gt;
$num_files = count(glob($_SERVER['DOCUMENT_ROOT'].'/path/to/directory/*.jpg'));
&lt;/code&gt;
</description>
				<link>http://www.epigroove.com/blog/use-php-to-count-number-of-files-in-a-directory</link>
				<pubDate>Wed, 21 Mar 2012 00:00:00  CDT </pubDate>
				<guid isPermaLink="false">Epigroove116</guid>
			</item>			
					<item> 
				<title>How to kill all MySQL sleeping processes</title>
				<description>&lt;p&gt;If you need to kill all sleeping processes in MySQL, here's a quick 'n' easy PHP solution:&lt;/p&gt;

&lt;code&gt;
$result = mysql_query(&quot;SHOW processlist&quot;);
while ($myrow = mysql_fetch_assoc($result)) {
	if ($myrow['Command'] == &quot;Sleep&quot;) {
		mysql_query(&quot;KILL {$myrow['Id']}&quot;);
	}
}
&lt;/code&gt;
</description>
				<link>http://www.epigroove.com/blog/how-to-kill-all-mysql-sleeping-processes</link>
				<pubDate>Mon, 30 Jan 2012 00:00:00  CDT </pubDate>
				<guid isPermaLink="false">Epigroove115</guid>
			</item>			
			</channel>
</rss>
