Tag Archives: programming

Enable Curl on Xampp

I generally do my development work on a local windows machine with the latest version of Xampp installed. I was recently toying around with the tayst twitter feed, and was having trouble using curl with xampp.

The problem?.. curl was not enabled by default in Xampp.  You receive the following error:

  • Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\tayst\twitter\index.php on line 4

The solution?  These simple steps!

Continue reading Enable Curl on Xampp

Customize The WordPress Contact Form 7 Plugin

I ran into an interesting problem the other day.    I’m a big fan of the WordPress Plugin Contact Form 7.  I’ve used it on many of the wordpress sites I’ve developed, and appreciate the plugin for its simple integration, nice admin interface, and the pretty ajax functionality.

Unfortunately, I recently discovered that the plugin does not allow you to specify custom landing page urls, or Thank You pages for the contact form.  Some of you may wonder why I care about reloading the page to say thank you vs. the sleak Ajax popup confirming that your message has been delivered.  The answer: Because I’m trying to measure performance of the contact form within my Google Adwords CPC account. Continue reading Customize The WordPress Contact Form 7 Plugin

Getting Rails to Work on a Windows Machine Running Xampp

Ruby on Rails logo

Wow… so I wrote a post on my struggles getting Rails to work on my Windows Machine, and then I figured it out. I’ve been developing in various languages, and using Xampp to for my server, database, and programming language (Apache, MySQL, PHP). Nevertheless, I have finally got it working, and it was a lot simpler than I had figured. In case you’ve come here and you’re yet to get Xampp… I’ll walk you through the whole process. If you already have it, then go ahead and skip to STEP 2

STEP 1 – Install Xampp – ApacheFriends has made it really easy by giving us a simple windows installer to download. If your interested in developing with Perl, Tomcat, you can download their Add-Ons by clicking the links. Once you download, just give it a click and follow the on-screen instructions. I recommend you install Xampp at the default c:\xampp (if you do not, remember to replace the code below with your installation directory). Here’s a video to show you how simple it is…don’t be fooled, it takes a little longer than the video shows.

STEP 2 – Install Ruby – Thanks to RubyForge, you can download an easy one-click Ruby installer to use here. Once you download, click to open, and follow the instructions. I recommend you install Ruby at c:\xampp\ruby so it falls in line with your other programming languages, etc…

STEP 3 – Install Rails – Fortunately, the Windows version of Ruby comes with RubyGems already set up. Open your Command Prompt (start-> run-> cmd -OR- start-> programs-> accessories -> command prompt) and type the following commands.

Do the gem update from the bin directory in rails. For my installation:

cd c:\ruby\bin
gem update

You may be prompted several times to choose which gem. Pick the highest version for (mswin32)

gem install rails --include-dependencies

There may be some delays, and the install could take a while. If you encounter an error trying to use the gem command, just restart the Command Prompt.

STEP 4 – Create a Rails App – While your still in Command Prompt, type the following Command (without the brackets, and change “your-app-name” to whatever you wish to call your application)

rails C:/xampp/htdocs/<your-app-name>

STEP 5 – Configure Apache – With your Xampp installation, http://localhost (localhost:80) defaults to the Xampp browser control panel, which displays your status, tests, etc.. We want to be able to use Ruby, without disrupting this service, or interfering with our standard Xampp settings. Open your Xampp directory (in our case C:\Xampp) and browse to Apache\conf\httpd.conf and open the httpd.conf file in a text editor or other text editor of your choice.

Scroll all the way to the bottom, and add the following:

Listen 3000
LoadModule rewrite_module modules/mod_rewrite.so
<virtualHost *:3000>
ServerName rails

DocumentRoot "c:/xampp/htdocs/<your-app-name>/public"
<Directory "c:/xampp/htdocs/<your-app-name>/public/">

Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi

Finally – Check it Out – Point your browser to http://localhost:3000 and you should see the “Welcome Aboard” from ROR.

If your also looking for some editors. A nice simple free PHP editor with great extensions is “PSPad“. For hardcore coding, I recommend Zend(free for 30 days). For a nice simple free Rails Editor, “RoRED“, something a little more intense I would say go with the free “NetBeans” (don’t forget the .jdk).

Update 04/15/09

I now dual boot to Linux to play with ROR vs. fighting to install ruby on rails on a windows machine. I found it to be an endless battle of debugging.

Note: This post was updated from my writings here… There may be comments there that can help you if you are struggling with this issue.

Enhanced by Zemanta

Installing Ubuntu Feisty Fawn on Virtual PC to Run Ruby on Rails

This post follows a 14 hour struggle to get Rails going on my Windoze Vista and my Windoze XP machine. I’ve been doing PHP development for a little while now, and have been using Xampp on both of my machines to create a local server for web-development. Recently we made a decision to build one of our in-house sites with Ruby on Rails, to take advantage of its agile nature, plugin modules, and overall speed of development. Boy was I in for a surprise.

Apparently, you cannot install Instant Rails, unless you want to try to figure out how to merge your 2 instances of Apache, and MySQL that are now running. In my hours of hunting, I could not come across a Rails plugin for Xampp. I tried to do a stand-alone rails install, and manually configure it, but then I could not use localhost for anything other than Ruby. This whole time, all I can think is that if I only had a Mac… but wait, I have an idea.

I’m a big fan of Windows Virtual PC 2007, so why not try to just set-up a Virtual Linux instance, and . Plus, once I get it set up, I can copy the Virtual PC hard-drive, and pass it around the office to everyone having the same problem I am.. BRILLIANT. For the record, I am writing this as I do it, so if I encounter FAIL, I’ll retitle, and post this in hopes someone can help.

Step 1Install Virtual PC 2007. This is one of the few free things that Microsoft offers, so I highly recommend you take advantage of it. You will find it to be quite versatile… I like the idea of running everything in a virtual PC, so if I need to buy a new computer, I don’t loose all my software and settings.. I just copy the Virtual Hard Drive, and BAM!, I’m ready to go. I also spec’d a lightweight machine, and copied it over to a thumb drive with a copy of the Virtual PC install file.. now I can load my personal PC on any windows machine.

Step 2Download Ubuntu 7.04 and Create a Virtual Machine. I am using a desktop version of Feisty Fawn, and can vouch that what I lay out here will work for this version only. To keep focus, I’m going to point you to Mike Kolitz for a detailed tutorial to install on Virtual PC. For some reason, some unanswered “issues” are not referenced though, and the answers are spread out, so if you encounter problems with video resolution, sound, networking (first click network, then wired), mouse, or system time < — check out the links. Please note – the install process takes about an hour, so try going for a jog, or pancakes..or both!

I edited the settings for my Virtual Machine to enable an “undo” function for the virtual drive. This way I could play with some of these “fixes” without worry of putting myself back to zero. When I make a system configuration change and it is successful, I go to the action menu, select close, and then select save state save changes (so I don’t have to wait on a reboot).

(Optional) Do a quick check for updates by going to terminal and typing (without quotes) “sudo apt-get update && sudo apt-get upgrade”. This will probably take a little while, so go grab a bottle of wine or a few beers and start drinking!

Step 3Install LAMP – Thanks to Joe Raad for the wonderful walk-through. If you follow his instructions, you’ll have no problem, and you get the benefit of installing through apt-get vs. some package, which is one of many AWESOME Linux functions. Unlike Windows, Linux uses the apt-get function to update not only your OS, but also all of the programs.. pretty sweet! We’ll try it out once we wrap up the Ruby install.

Step 4 – Install Ruby on Rails –

-Start with Ruby using apt-get  (all on one line)

~$ sudo apt-get install apt-get install ruby rdoc irb libyaml-ruby
libzlib-ruby ri libopenssl-ruby ruby1.8-dev build-essential

-Install Gems from source (we are not using apt-get here because Gems updates itself and Rails, and we don’t want to confuse apt-get

~$ wget http://rubyforge.org/frs/download.php/34638/rubygems-1.1.0.tgz
~$ tar -xvzf rubygems-1.1.0.tgz
~$ rm rubygems-1.1.0.tgz
~$ cd rubygems-1.1.0
~$ sudo ruby setup.rb

-Allow Ruby Gems to update itself (and make sure gem installed properly)

~$ sudo gem update --system

If you get a gem: command not found error.. create a symbolic link by executing this:

~$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

-Now, we install Rails using Ruby Gems

~$ sudo gem install rails
~$ PATH=${PATH}:/var/lib/gems/1.8/bin/
~$ export PATH

-Add the Driver for MySQL

~$ sudo apt-get install libmysql-ruby

Alright, now that the grunt work is over, you can start building some applications. Have fun!

Update 05/03/08

I finally got it working on Windows – check it out

Update 04/15/09

If I want to use Ruby on Rails (ROR) I dual boot to Linux vs. fighting to install Rails on Windows machine.

Note: Post is imported from my writings here … there may be some comments there that are helpful!