crshman's Profile Page

Archive for the Category » Development «

Wednesday, July 29th, 2009 | Author:

Hey All,

Well I’ve been baking a lot of cake lately, and I’ve started to delve into the core a little….it’s not all that scary…kinda haha.

This post is being made in response to the infamous:

Warning (512): Cache not configured properly. Please check Cache::config(); in APP/config/core.php [CORE/cake/libs/configure.php, line 663]

I believe I found a fix/solution for this, and from what I can tell it’s quite portable (you can use it across different installations). This solution would be used in conjunction with providing the proper credentials to your cake installations “tmp” folder and all it’s sub-directories so that your web server can get down to business.

Open up your core.php file and look for the following at the end of the file:


Cache::config('default', array('engine' => 'File');

and replace it with


Cache::config('default', array('engine' => 'File', 'path' => ROOT.'/app/tmp'));

That should do it!

Until next time, l8rz!

Category: Development  | Tags: ,  | 4 Comments
Thursday, April 23rd, 2009 | Author:

Hey All,

So I have an account over at JaguarPC and I love it a lot there, they support everything I need and help me with all that I ask. However, there seems to be a snafu/caveat what have you to running RoR (Ruby on Rails) apps at JPC. cPanel runs RoRs apps using a mongrel instance, this is fine and it works….but sometimes it dies and needs to be restarted. Highly annoying….I run my redmine installation off of one of these mongrel instances and I really can’t have it be down. So….I devised this little gem below to check if your mongrel instance is down, if so to restart it.

To use the script throw it in your cPanel root and add the following line to your crontab:


*/5 * * * * php ~/reboot.php

Be sure to update the command above to reflect what you named the script…..

Hopefully someone else finds it useful and if you need help with the script comment!

cPanel Ror Mongrel Reboot


<?php
/*
 *
 * cPanel Mongrel Rebooter - v0.1
 * Author: Robert Navarro <[email protected]>
 *
 */

/*
 * The siteCheck function has the following parameters
 *
 * $url - This is the url of the application you want to check
 * $searchString - This is the erroneous string you want search the site for
 * $appPath - This is the full path to your cPanel RoR app installation
 * $appPort - This is the port that your cPanel RoR app runs on
 *
 * You can find the application port by running:
 * # ps aux |grep mongrel |grep <your username>
 *
 */
siteCheck("http://<my redmine install>","502 Proxy Error","~/Sites/<my redmine install>/","12001");

function siteCheck($url,$searchString,$appPath,$appPort) {
 // open the remote URL for reading
 $fp = fopen($url, 'r') or die('Unable to open file '.$off_site.' for reading');

 $buffer = '';

 // read in chunks
 while(!feof($fp))
 {
 $buffer .= fgets($fp, 4096);
 }

 // strip HTML but leave the tags you want
 $output = strip_tags($buffer,'<a>
<ul>
	<li>
<h2>
<h1><span>');

 // convert all whitespace, tabs and newlines into one single whitespace
 $output = preg_replace('/\s+/', ' ', $output);

 if(strstr($output,$searchString)) {
 restart($appPath,$appPort);
 }
}

function restart($path,$port) {
 exec("cd $path;mongrel_rails start -p $port -d -e production -P $path/log/mongrel.pid");

}
?>

Category: Development  | Tags:  | 5 Comments
Tuesday, March 31st, 2009 | Author:

Hey All,

Well I was going to include this post with my last one, but I figured I’d separate the two being as they are two completely different content types (for the most part). So I’ve officially jumped ship from SVN to the Git SCM and man….I’ve been missing out on a lot! Branching, distributed-ness, forking….all wonders of the modern day developer!

With that I’ve also decided to move away from a perpetual trial of ZDE =X to a more legitimate, purchased copy of the Aptana Studio Professional Plugin. The guys over at Aptana were kind enough to bless me with an educational license of their eclipse addon at half price! Thanks again guys!

Another thing that I’ve been trying to get myself into is TDD (Test Driven Development) to better standardize my coding methodologies and to reap some of the benefits that TDD offers! It’s definitely a monumental shift in my programming paradigm and thinking, but in the end I think it will be well worth it! I’m still trying to get my head around the actual testing and implementation of TDD (the concepts behind it are relatively easy to understand), if anyone that reads this knows what I’m talking about feel free to comment so we can discuss!

That’s all for now! L8rz

Category: Development, General, Internetz  | Tags:  | Comments off
Monday, March 30th, 2009 | Author:

Hey All,

Well Spring 09 has arrived, it officially started today…Monday….thankfully I have no classes on Monday so I didn’t really do much of anything other than sleep. However, tomorrow I have to hit the ground running and do well on all my classes. This quarter should be interesting considering the gamut of ideas I have in store for Phiivo and the engineering courses I am taking.

Still not sure which direction I am going to take Phiivo in, consulting or web dev? Or both? Not entirely sure…..as for now I can only say that I have something relatively big brewing with dad. If this idea takes off this could mean good things =)

With that I need to further my knowledge on this AJAX boat I jumped on……it could prove to be a crucial skill for the future. Using frameworks makes quick work of doing things, but that still doesn’t deter from the time needed to learn said technologies. We’ll see how things go!

Until next time, l8rz!

Category: Development, General  | Tags: ,  | Comments off
Monday, March 23rd, 2009 | Author:

Hey All,

So….Spring Break 2009 is officially here (started on Friday for me!) and it’s usually the time of the year where I get bored and think of 200 projects to do but never get completed haha.

So now we begin my guide to install Aptana and PDT onto a basic 3.4 install.

First we need to download the clean 32bit Eclipse 3.4.2 SDK:

http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4.2-200902111700/eclipse-SDK-3.4.2-linux-gtk.tar.gz

Once we have that we’re going to extract it using the following commands:

tar -zxvf eclipse-SDK-3.4.2-linux-gtk.tar.gz

Next we’re going to start up eclipse so we can install the plugins:

/eclipse/eclipse

From here we’re going to install PDT:

Go to Help –> Software Updates (If there are two, the bottom one without a submenu)

The click on the “Available Software” tab

Select Add Site

Paste the following link into the window:

http://download.eclipse.org/tools/pdt/updates/2.0/interim/

Wait for eclipse to contact the sites….then select the arrow next to the PDT Update Site

I choose the nightly builds for my install, but you can choose what you wish. What we’re looking for is the “PDT Runtime Feature” you can select this from any of the versions, but you generally want the latest version.

After that is selected press the install button on the top right and wait….eclipse will calculate the dependancies and find everything you need. Proceed with the install and you should be good to go!

After eclipse restarts you can follow the instructions on the Aptana website to get the plugin installed!

Category: Development  | Tags: ,  | Comments off