Wednesday, February 10, 2010

cakePHP New Default Theme - Condition

I have always wanted a new theme whenever I develop a cakePHP applications. The default theme is OK, but sometimes you want a little more gradients. So I took a free design from freecsstemplates.org, and tweaked it into a default theme for my cakePHP applications. The theme is full screen and looks like this:


This theme was created in cakePHP 1.2 . To use it for your next cakePHP app, just follow these instructions:
  1. Download the code here.
  2. In the root of your cakePHP projects (the directory with the cake core folder), you will see the global vendors folder for all your applications.
  3. Drill down into the vendors folder, vendors > shells > templates, and delete the skel folder.
  4. Unzip the theme in this folder, and it should unpack a new skel folder.
  5. Now anytime you want to create an app with this theme append the following to your cake bake command

-skel vendors/shells/templates/skel

So it should look something like this
cake bake -skel vendors/shells/templates/skel

If you have created your own theme, please post a link in the comments. Take care.

Wednesday, February 3, 2010

MAMP, Virtual Hosts, and Parallels

I do not know why, but setting up stuff seems harder then it really is. I guess it does not help when you Google for answers, and all you get is information that is outdated, or way too complicated to understand. I hope to clarify things here. Here s my current setup:

Parallels Desktop 5
MAMP 1.8.3
Mac OSX 10.5.8

I wanted to use my local virtual hosts on my Parallels Desktop, so I can test my sites on Internet Explorer. It actually is really easy.

Setting Up A Virtual Host in MAMP
1. Open Terminal
2. Type in:

cp /etc/hosts /etc/hosts.bak

This creates a backup of the file before editing it.

3. Type in:

sudo mate /etc/hosts

Please note mate tells the Terminal to open the file in Textmate, use the command for your Development Software.

4. Add the following to the file

127.0.0.1 *the virtual host name*

5. Save the file, and close it
6. Now type in:

cp /Applications/MAMP/conf/apache/httpd.conf
/Applications/MAMP/conf/apache/httpd.conf.bak

7. Type in:

mate /Applications/MAMP/conf/apache/httpd.conf

8. Add the following to the bottom of the file

NameVirtualHost *:80
<virtualhost>
DocumentRoot "/Document/Root/of/MAMP"
ServerName localhost
</virtualhost>
<virtualhost>
DocumentRoot "/Document/Root/of/first/project"
ServerName *the virtual host name*
</virtualhost>

Please note, only add all the above if you have never setup a virtual host on MAMP. To add to the existing virtual hosts, you will only need to add the following:

<virtualhost>
DocumentRoot "/Document/Root/of/first/project"
ServerName *the virtual host name*
</virtualhost>

I usually use projectname.local for the virtual host name.

9. Restart MAMP
10. Open a browser, and point to the virtual host that you setup. You should now see your local website.

Setting Up Parallels
1. On your Mac, click the Apple > System Preferences > Network, and jot down your IP Address
2. Open Parallels, and click Start > Run. Enter this command:

wordpad c:\\windows\\system32\\drivers\\etc\\hosts

3. Add this to the bottom of the file:

*Your IP Address* *Your Virtual Host*

For Example:

192.168.1.2 myproject.local

4. Repeat for all Virtual Hosts
5. Save the File

Now you should be able to access your virtual hosts through Parallels. Happy Coding.

Tuesday, November 17, 2009

Redmine on Site5

If you ever had to install a rails app from scratch on a server, it can truly be daunting. Over the last few months, I found myself installing multiple versions of Redmine, an open source Rails project management tool. I realized there must be an easier way to do this. So I created a Capistrano recipe that will handle all the hard work. Here is how you accomplish it:

Required
  • A hosting account at Site5
  • some experience with Terminal
  • some experience setting up a website
Preliminary Setup
  1. FTP/SSH to your hosting account
  2. Set up an App Directory for the new application in the public_html folder (ex. var/user/public_html/test)
  3. Create a .htaccess file in that folder with the following content: RewriteEngine Off
  4. Add a public folder in that folder (ex. var/user/public_html/test/public)
  5. Point the document root of that domain or subdomain to the public folder you just created
  6. Set up a database for your new redmine app
Redmine Setup
  1. Download the Capistrano recipe
  2. In terminal on your local machine:
    1. Install the capistrano gem ( cmd> gem install capistrano)
    2. locate the cap file in the directory you downloaded ( cmd> cd to/directory/of/the/capfile)
    3. Run the setup for redmine (cmd> cap redmine:new)
    4. Answer Several Questions
      • Application Name: Name of the current application (must be safe for a directory name ie. no spaces)
      • Domain Name (without subdomain or www [ie. travelingfoam.com]): Domain name where the site is hosted
      • FTP User: The ftp username
      • FTP Password: The Ftp password
      • Folder Name in public_html where site is located: The name of the APP Directory
      • Database Name: Database name
      • Database User: Database User
      • Database Password: Database Password
    5. Run the migrations for redmine( cmd> cap redmine:migrate)
    6. Answer Several Questions
      • Application Name: Same as before
      • Domain Name (without subdomain or www [ie. travelingfoam.com]): Domain name where the site is hosted
      • FTP User: The ftp username
      • FTP Password: The Ftp password
Thats it. Now dance a jig :)

Wednesday, August 5, 2009

World's Worst Tech Vlog

This is a great video that will make you rethink creating your own vlog. My friend Paul and I want to see this go viral, so please share it with everyone you know. Find out more by visiting Paul's Tech Blog.

Monday, June 8, 2009

FLEX Your Gifts!

A couple of weeks ago, I decided to get my feet wet with some FLEX Development. FLEX is such a "flexible" tool, since it helps Web Developers build desktop application that interact with their website. These applications are not platform specific, which gives the developer a large user base. As I took my first steps, I decided to make a prototype of a new Joshua Project Widget. Joshua Project approved the widget, and I am proud to give you access to it. There are 2 ways you can use this widget.

Install on Your Website

To install this application on your existing website, simply copy and paste the following embed code.


Install on Your Desktop (Works on PC or Mac)
  1. Download & Install the Adobe AIR software by clicking here.

  2. Download & open the Adobe AIR package located here.
Please let me know what you think.

Tuesday, April 21, 2009

Iconify my site?

If you spend even 5 minutes Googling for "free website icons",  you will be extremely overwhelmed.  Especially if your looking for commercial use icons.  So I did the footwork for you and found several sets of icons that can be used for personal and commercial uses.  So fill up your library and enjoy.

Friday, April 17, 2009

Rake test:functionals failed... Miserably.

So for the last few hours,  I have been staring at 65 testing errors that were not present before I integrated AuthLogic.  AuthLogic is a pretty cool Authentication Plugin that allows you the ability to write up all the controller code,  but let AuthLogic handle all the logging in and out.  Despite my frustration with getting 2 completely different error messages based on how I ran the test (either via autotest or via rake test:functionals),  I ran on multiple rabbit trails.  First I thought the user table was not being created.  When I googled information on tests losing tables I found nothing that helped.  After a few hours,  I started to realize that you need to have AuthLogic create a user session,  before you can test a restricted functional.  So finally I stumbled on this:  http://authlogic.rubyforge.org/classes/Authlogic/TestCase.html . I guess I should have spent more time reading about AuthLogic.  Enjoy.