Thursday, September 3, 2009

What IDE are you?

As a programmer, you probably have a specific IDE(Integrated development environment) that you absolutely love and feel comfortable with unlike no other.

So what IDE takes your heart away?

ColdFusion Builder
Visual Studio

That's just a small slew of IDE's available to us developers. So what I'm asking is....what's your favorite for what ever you may be developing?

CFML - ColdFusion Builder
PHP - NetBeans
ASP.NET - Visual Studio (shocker there)

- Pete

Generating numbers with Date and Time using ColdFusion and PHP

Recently I was asked to create a simple script either in ColdFusion or PHP that would generate a unique number, so I said why not have some fun using date and time and code it in both languages. Both scripts will generate a number containing of 23 numeric characters. Took me about 5 minutes to get everything coded and tried to keep the examples in both ColdFusion and PHP as similar as possible and I'm sure there's an easier way to do this. So please don't say Hey! you can do this and that and this and that lol.

Both scripts will generate a number similar to 42453609032009061855012

<cfset d = Now()>
<cfset day_week = DayOfWeek(d)>
<cfset day_year = DayOfYear(d)>
<cfset week_year = Week(d)>
<cfset month_year = DateFormat(d, "mmddyyyy")>
<cfset time_hour1 = TimeFormat(d, "hhHHmmss")>
<cfset ts = TimeFormat(d, "tt")>

<cfswitch expression="#ts#">
<cfcase value="am">
<cfset time_span = 1>
<cfcase value="pm">
<cfset time_span = 2>

<cfset date = "#day_week##day_year##week_year##month_year#">
<cfset time = "#time_hour1##time_span#">
<cfset date_time = "#date##time#">


$d = date("a");
switch ($d) {
case "am":
$day_time = 1;

case "pm":
$day_time = 2;

$date_time = "wzWmdYhHis";
$dt = date("$date_time$day_time");

echo $dt;

Wednesday, September 2, 2009

Set up a WAMP and ColdFusion Testing Server Super Fast

Ever need to set up a testing server on a local machine during the development of a project or possibly even studying. I know I have and here's what just may be the quickest way to get up and running in less than 15 minutes on a Windows machine. Although it may look like a lot of instructions, the process actually goes pretty quick.

The server configuration will contain the following:

  1. Apache
  2. MySQL
  3. MySQL GUI Tools
  4. PHP
  5. ColdFusion 8

First thing to do is download the following:

  1. WAMP
  2. MySQL GUI Tools
  3. ColdFusion 8 Developer Edition

Note: To get ColdFusion, you must register with Adobe or use an existing account that you have with them.

WAMP Installation:

  1. Open the WAMP executable and click next to begin the set up.
  2. Select the radio button indicating that you accept the agreement.
  3. Accept the default location to install WAMP to.
  4. Don't worry about creating any shortcuts, and click next.
  5. Click the install button and WAMP will then be installed on your system.
  6. During installation you will be asked for SMTP, email information and for a default browser.
  7. Once set up completes click finish to launch WAMP.
  8. Apache should now be running but WAMP Server will not be online. to put WAMP online, click the WAMP Server icon down by the system tray and select "Put Online".
  9. Now Apache MySQL and PHP should be up and running.

MySQL GUI Tools Installation:

  1. MySQL GUI Tools are pretty simple to install. Just execute the installer and follow the screens. You basically will just be clicking through the wizard until installation is complete.
  2. Once the installation has complete the following 2 main applications should be installed, MySQL Admin and MySQL Query Browser.

MySQL User Accounts and Privileges:

  1. By default there is no password set for the root user account which is a security risk, therefore a password must be set for this account.
  2. Click the WAMP Server icon located in the system tray and select Localhost.
  3. Under “Tools” select the “phpmyadmin” link to go to the PHPMyAdmin page.
  4. On the main top menu click the Privileges link.
  5. Click the edit button for host root account.
  6. Now locate “Change password” and enter a password in both fields and click the corresponding “Go” button.
  7. Now go back to the Privileges page once again and this time click the edit button for the localhost root account and do the same as before. Locate “Change password” and enter a password in both fields. The password should be the same as root account.
  8. Now click the “Home” button on the left sidebar. You should receive the following error: “#1045 - Access denied for user 'root'@'localhost' (using password: NO)” This problem can easily be corrected so not to worry.
  9. Locate the location where you installed WAMP. The default location is C:\wamp.
  10. Now enter the “app” directory then the phpmyadmin directory.
  11. Now locate and open the file with any text editor.
  12. We are looking for line 16 (may be different), but the code should read $cfg['Servers'][$i]['password'] = '';
  13. Between the single brackets, enter the password you entered into PHPMyAdmin ex: $cfg['Servers'][$i]['password'] = 'mypassword';
  14. Save the file and refresh the PHPMyAdmin page. The error should now be gone and be able to view the PHPMyAmin page.
  15. Finally... we need to create a new user because using the root user account is a big security risk and highly fround upon.
  16. Go back into the Privileges section and click on the “Add a new user” link.
  17. For “User name”, just enter a username of your choice leaving the select menu as it’s default value.
  18. Ignore the “Host” select menu and continue on to the “Password” field.
  19. Enter a password in the password field leaving the default value for the select menu.
  20. Make sure to Re-type the user password in the next field labled “Re-type”.
  21. Now on to the Global privileges section. Here we can give the new user permissions to execute SQL commands. I recommend just allowing the basics such as SELECT, INSERT, UPDATE, DELETE, FILE and CREATE unless you think you may need to run more commands. What I highly suggest is to leave the DROP command un checked for the reason that mistakes do happen. Meaning, you could create a database and some tables, populate those tables and execute the DROP command by accident. That would be very very……bad. Especially if you have hundreds or thousands or millions of rows in your tables. be safe, just leave it un checked.
  22. That should be it for setting up MySQL. You should now be able to either use PHPMyAdmin or MySQL Admin and MySQL Query Browser to make databases, tables and edit table content.

Now for ColdFusion:

  1. Run the ColdFusion executable and wait patiently for the installation wizard to show (Could sometimes take 2 minutes or even longer to show).
  2. Once the ColdFusion installation screen appears select the language of choice from the drop down and click OK to continue.
  3. Click Next for the next screen and click the “I accept the terms of the License Agreement” radio button and click Next.
  4. Select the Developer Edition checkbox and click Next
  5. Accept the default configuration of “Server configuration” and click Next
  6. Accept the default selected checkboxes for Subcomponents and click Next
  7. Accept the default installation location for ColdFusion to be installed and click Next.
  8. Click the radio button for “I accept the terms of the License Agreement” radio button and click Next.
  9. No need to enter a Serial Number since we don’t have one, so just click Next.
  10. Now to set up ColdFusion to run under the WAMP Server.
  11. Click the Add button and leave the default of Apache selected.
  12. Click the “Configuration Directory” button so we can find the location of the Apache configuration file.
  13. Locate the default location where you installed WAMP, the default is C:\wamp and navigate through the following directories. bin\apache\apache”version number”\conf\
  14. Just select the conf directory and click the OK button.
  15. Now click the “Directory and file name of server binary” button and locate the default location where you installed WAMP.
  16. Now navigate through the following directories, bin\apache\apache”version number”\bin\ and select the httpd.exe and click select.
  17. Click OK on the configuration window and click Next.
  18. Now to choose where to extract the ColdFusion Administrator. Click the “Choose” button.
  19. Locate the default location where you installed WAMP and select the www directory, click OK and then click Next to continue.
  20. Enter a password for the ColdFusion Administrator and click Next.
  21. Don’t worry about enabling RDS so just click Next.
  22. Now click Install to run the ColdFusion installation.
  23. Once the installation is complete, make sure the checkbox for “Launch the Configuration Wizard in the default browser” is checked and click Done.
  24. Once the Configuration Wizard begins in the browser, enter the password you entered for the ColdFusion Administrator and click Login.
  25. Now you wait for the configuration to complete…….
  26. Once the configuration is complete, Click the OK button to open the ColdFusion Administrator.

That should do it for this whole process of getting a testing server up and running in about 15 minutes. Feel free to comment on my instructions especially if I made a mistake somewhere.

- Pete

Tuesday, September 1, 2009

Let's talk Content Management Systems

Straight to the point here... Content Management Systems. If you're a developer, it's almost a guarantee that you may have made some kind of Content Management System or CRUD at least twice in your career. If not then you're missing some key experience that you definitely need to succeed in the world of being a web developer. Doesn't matter the language you specialize in just that you have the ability to make a system where a client can manage their website them selves. Again, language choice doesn't matter. ColdFusion, PHP, C# or VB.NET, Python or even Rails. Just do it and you'll be very happy you have that knowledge under your belt.

Now that I got that out of my system I'm probably gonna bore with the idea for my next personal project. Yep!!! A Content Management System. I've built many before but always to the vision of others not my own. I figure that it's time for me to do it the way I think a Content Management System should be built. With lot's and lot's of functionality and cool features that makes use of the amazing technology us devs have at our finger tips today.

A while back I started a CMS called CMSLeo that I never got even close to completion (and can also be seen unfinished on my website :). But now is the time to get back into the game of developing this beast to completion and to my vision.

The question on mind was to which language to program it in. ColdFusion or PHP?

The ups for ColdFusion:
  1. Easy and rapid development with very clean code management
  2. Simple to upgrade and scale code
  3. The best yet, an amazing community

Now the downs for ColdFusion:
  1. Big price tag for whomever wanted to use my CMS
  2. Um.......... that's it

PHP ups:
  1. Very popular language
  2. Open source language
  3. Easy to get up and running
  4. Huge community

PHP downs:
  1. Code tends to get messy
  2. Community a bit temperamental
  3. Possible long development time
As of right now I'm pretty much set on coding my CMS in ColdFusion mainly because of a CFML Engine called Railo. Railo is an open source project that will run ColdFusion code (CFML) and again, it's open source. In fact, I am thinking about developing my CMS completely under Railo. Might be a bad idea might be a good one and I'm sure devs out there will put this idea down and of coarse some that will be all about the idea.

Finally, when I plan a project I try to put myself into the everyday user's point of view and think how I can make my project extremely simple to understand and just jump right into using what I created. That's exactly what CMSLeo will be. One of the most user friendly Content Management Systems available today.

- Pete