Unable to Start Apache – Xampp

Hey everyone,

I was mucking around with xampp this morning and ran into the following issue with apache:

3:41:52 PM [main] Initializing Control Panel
3:41:52 PM [main] Windows Version: Windows 8 Pro 64-bit
3:41:52 PM [main] XAMPP Version: 5.6.3
3:41:52 PM [main] Control Panel Version: 3.2.1 [ Compiled: May 7th 2013 ]
3:41:52 PM [main] You are not running with administrator rights! This will work for
3:41:52 PM [main] most application stuff but whenever you do something with services
3:41:52 PM [main] there will be a security dialogue or things will break! So think
3:41:52 PM [main] about running this application with administrator rights!
3:41:52 PM [main] XAMPP Installation Directory: “c:xampp”
3:41:52 PM [main] Checking for prerequisites
3:41:52 PM [main] All prerequisites found
3:41:52 PM [main] Initializing Modules
3:41:52 PM [Apache] Problem detected!
3:41:52 PM [Apache] Port 80 in use by “Unable to open process” with PID 7820!
3:41:52 PM [Apache] Apache WILL NOT start without the configured ports free!
3:41:52 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
3:41:52 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
3:41:52 PM [Apache] Problem detected!
3:41:52 PM [Apache] Port 443 in use by “Unable to open process” with PID 7820!
3:41:52 PM [Apache] Apache WILL NOT start without the configured ports free!
3:41:52 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
3:41:52 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port

In order to fix this, you can just kill the process that is blocking the port. Unfortunately I had IIS on this and needed another solution. As always, stackoverflow had the answer:

– In the xampp control panel, click config (same line as apache) and open the httpd.conf file
– Search for listen 80 and change it to list 8080 (or an alternative free port)
– Save and close the file
– In the xampp control panel, click config (top right)
– Click service and port settings and change the main port (and ssl if necessary) to match your httpd.conf file
– Click save and restart apache (note you may also need to run as administrator)

Check out this link for more info: http://stackoverflow.com/a/25113205/522859

Retrieving Thumbnail from an Animated Gif – CarrierWave

Hey everyone,

I’ve been mucking around with CarrierWave today and ran into a bit of an issue. When creating a thumbnail from an animated gif the thumbnail was also animated. Unfortunately this led to some of my image-heavy pages hanging for a bit.

This StackOverflow post offers the following solution:


#Add this method in your uploader
def remove_animation
  manipulate! do |img, index|
    index == 0 ? img : nil
  end
end


#Adjust your thumbnail process so that it now includes a call to the new function
version :thumb do
  process :remove_animation
  process :resize_to_limit => [75, 75]
  process :convert => 'jpg'
end

Simple Staging/Test Environment with Heroku – Ruby on Rails

Hey everyone,

This is just a quick guide on how to create a test/staging environment with Heroku.

-- Create staging environment
heroku create --remote staging

-- Push to staging app
heroku push staging master

-- Run rake db:migrate on staging app
heroku run rake db:migrate --remote staging

-- Add pgbackups add ons
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote heroku

-- Create backup of production data
heroku pgbackups:capture --remote heroku

-- Copy to staging environemnt
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote heroku` --remote staging

-- Create a new config file called staging.rb (/config/environments/staging.rb)

-- Add environment variables
heroku config:add RACK_EVN=staging RAILS_ENV=staging --remote staging

-- Ready to go !

For those of you using git branches etc, the following may come in handy as well:

-- Create local development branch
git branch development

-- Switch to dev branch
git checkout development

-- Make your changes and commit them
git init
git add .
git commit -m "My changes"

-- Push to staging environment (local development branch to staging environment master branch)
git push staging development:master

If you run into any trouble, I found the following links pretty helpful:

http://stackoverflow.com/a/6931462/522859
https://devcenter.heroku.com/articles/pgbackups#transfer
https://devcenter.heroku.com/articles/multiple-environments

Let me know if you’ve got anything to add.

Assets:Precompile (Rake Aborted) – Heroku

Hey everyone,

I ran into the following error over the weekend while trying to push to heroku:

Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host “127.0.0.1” and accepting
TCP/IP connections on port 5432?

This stackoverflow post helped to solve the issue. All you need to do is add the following line to your application.rb file:

#Applicication.rb
config.assets.initialize_on_precompile = false

Let me know if you have any problems.

Installing SQL Developer on Ubuntu – make-sqldeveloper-package chmod: missing operand after `755′

Hey everyone,

I was following a guide while trying to install SQL Developer on Ubuntu, however I ran into the following error:

make-sqldeveloper-package chmod: missing operand after `755′

 

To fix it, simply change line number #381 in ‘/usr/bin /make-sqldeveloper-package’ as follows:

Original

${FIND} "${OPTDIR}" ! ( -type d -o -name "*.jar" ) |${XARGS} ${XARGS_OPTS} ${FILE} ${FILE_OPTS} |${GREP} ${GREP_OPTS} "shell script text executable" |${CUT} ${CUT_OPTS_FUNC_CLEAN} |${XARGS} ${XARGS_OPTS} ${CHMOD} ${CHMOD_OPTS}

Modified

${FIND} "${OPTDIR}" ! ( -type d -o -name "*.jar" ) |${XARGS} ${XARGS_OPTS} ${FILE} ${FILE_OPTS} |${GREP} ${GREP_OPTS} "shell script" | ${GREP} ${GREP_OPTS} "text executable" |${CUT} ${CUT_OPTS_FUNC_CLEAN} |${XARGS} ${XARGS_OPTS} ${CHMOD} ${CHMOD_OPTS}

Thanks to this blog post for the solution, just note that it is Polish.

Let me know if you have any issues!

WARN Could not determine content-length of response body – Ruby on Rails

Hey everyone

I was going through my development logs today and noticed that the following line was appearing everywhere:

WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

While nothing appeared to be wrong, it made the logs a lot harder to read. A stackoverflow post indicates that this is a webrick issue that can be avoided by switching to thin. This is also the recommended option for heroku. In order to use thin, you simply need to add it to your Gemfile:

#Gemfile

#Added gems
gem 'therubyracer' #JavaScript
gem 'thin' #Instead of webrick

Run bundle install

chris@chris-VirtualBox:~/calendar$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.0.2) 
Using i18n (0.6.1) 
Using multi_json (1.4.0) 
Using activesupport (3.2.9) 
Using builder (3.0.4) 
Using activemodel (3.2.9) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.2.2) 
Using actionpack (3.2.9) 
Using mime-types (1.19) 
Using polyglot (0.3.3) 
Using treetop (1.4.12) 
Using mail (2.4.4) 
Using actionmailer (3.2.9) 
Using arel (3.0.2) 
Using tzinfo (0.3.35) 
Using activerecord (3.2.9) 
Using activeresource (3.2.9) 
Using bcrypt-ruby (3.0.1) 
Using bundler (1.2.3) 
Using coffee-script-source (1.4.0) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.7.5) 
Using rdoc (3.12) 
Using thor (0.16.0) 
Using railties (3.2.9) 
Using coffee-rails (3.2.2) 
Installing daemons (1.1.9) 
Installing eventmachine (1.0.0) with native extensions 
Using jquery-rails (2.1.4) 
Using libv8 (3.3.10.4) 
Using pg (0.14.1) 
Using rails (3.2.9) 
Using sass (3.2.3) 
Using sass-rails (3.2.5) 
Using therubyracer (0.10.2) 
Installing thin (1.5.0) with native extensions 
Using uglifier (1.3.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

And finally start thin:

chris@chris-VirtualBox:~/calendar$ rails s thin
=> Booting Thin
=> Rails 3.2.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop

If you’d prefer to keep using Webrick, the following patch is said to resolve the issue:
https://bugs.ruby-lang.org/attachments/2300/204_304_keep_alive.patch

The Name is Either Already Used or Reserved by Ruby on Rails

Hey everyone,

I ran into the following error while attempting to create a new model called calendar today:

chris@chris-VirtualBox:~/calendar$ rails g model calendar
      invoke  active_record
      The name 'Calendar' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.

It turns out that this was due to the fact that my application was also called Calendar. In order to get around this I decided to rename the application. This required a little bit of searching and thanks to this Stackoverflow post I found references in the following files:

– config/application.rb
– config/environment.rb
– config/environments/development.rb
– config/environments/production.rb
– config/environments/test.rb
– config/initializers/secret_token.rb
– config/initializers/session_store.rb
– config/mongoid.yml (if using Mongoid)
– config/routes.rb
– config.ru
– Rakefile
– app/views/layouts/application.html.erb, in title tag
– initializers/secret_token.rb
– initializers/session_store.rb

Let me know if you find any more spots that I’ve missed!

Paypal_Adaptive IPN Verification: INVALID – Ruby on Rails

Hey everyone,

I’ve been working with the PayPal_Adaptive gem recently and unfortunately I’ve run into a few issues. The latest of these has been that that my IPN verification was returning an INVALID response from Paypal.

I had made a few modifications to the provided payment_notification.rb file in order to accommodate for a few app specific requirements. This left me having to pass the original data attribute params. Unfortunately this wasn’t identical to the response that PayPal expected, I actually needed to use the following:


#Incorrect usage
verify_ipn(params)

#Correct usage
verify_ipn(request.raw_post)

I realised this error after reading Tanel’s post about securing your IPN interactions so make sure you check out his blog if you run into any more problems!

Thanks,
Chris

Git with KDiff3 – Windows

Hey all,

Just a quick post showing the config I needed to use in order to get KDiff3 working with git. It took a while to get this working so hopefully it’ll be able to help someone else out.

#Config file
[user]
	email = test@test.com.au
	name = test
[core]
	editor = "C:\Program Files\Sublime Text 2\sublime_text.exe"
   
[apply]
    whitespace = fix

[color]
    branch = auto
    diff = auto
    interactive = auto
    status = auto


[core]
        pager = less -FRSX
        whitespace = cr-at-eol
        autocrlf = input
        excludesfile = /Users/test/.gitignore_global
        editor = mate -w

[alias]
        co = checkout
        lg = log --graph --pretty=oneline --abbrev-commit

[gui]
	recentrepo = Y:/Projects/Junk
	recentrepo = C:/xampp/htdocs/onlinemedia
[merge]
	tool = kdiff3

Screenshot of git config from GUI:

Git Config KDiff
Git Config KDiff

Running KDiff3:

Executing KDiff3
Executing KDiff3

KDiff3 display:

KDiff3 Display
KDiff3 Display