Archive | November, 2010

CentOS: HowTo install ruby, rubygems and passenger for a redmine install

I like to put my complied software in /opt vs /usr/local. Make sure rpm version is not installed.

install ruby:

./configure --prefix=/opt/ruby-1.8.7-p174
sudo make && sudo make install

user alternatvies to create sym links:

/usr/sbin/alternatives --install /usr/bin/ruby ruby /opt/ruby-1.8.7-p174/bin/ruby 1 \
--slave /usr/bin/rdoc rdoc /opt/ruby-1.8.7-p174/bin/rdoc \
--slave /usr/bin/ri ri /opt/ruby-1.8.7-p174/bin/ri \
--slave /usr/bin/irb irb /opt/ruby-1.8.7-p174/bin/irb \
--slave /usr/bin/erb erb /opt/ruby-1.8.7-p174/bin/erb \
--slave /usr/bin/testrb testrb /opt/ruby-1.8.7-p174/bin/testrb \
--slave /usr/bin/gem gem /opt/ruby-1.8.7-p174/bin/gem \
--slave /usr/bin/rake rake /opt/ruby-1.8.7-p174/bin/rake

make sure current ruby is set to 1.8.7: /usr/sbin/alternatives –config ruby

install rubygems:

sudo ruby setup.rb

install gems (No docs):

gem install --no-rdoc --no-ri rails
gem install --no-rdoc --no-ri passenger
gem install --no-rdoc --no-ri mysql
gem install --no-rdoc --no-ri rack -v=1.0.1

Passenger said I needed to install curl-dev  (yum install curl-devel)

install passenger apache module:


modify your httpd conf file

   LoadModule passenger_module /opt/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/
   PassengerRoot /opt/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/passenger-3.0.0
   PassengerRuby /opt/ruby-1.8.7-p174/bin/ruby

Install redmine according to Docs

My current WordPress Update Script

Below is my current WordPress update script. First this script downloads the most recent version and determines which version it is:

cd ~/src/
rm -f ~/src/latest.tar.gz
rm -rf ~/src/wordpress/
wget -q
tar -xzf latest.tar.gz
CURRENTVERSION=$(grep "wp_version =" wordpress/wp-includes/version.php | cut -f 3 -d " " | sed "s/;//" | sed "s/'//g")
echo "Latest Version: $CURRENTVERSION"

Next it looks for all wp-config.php files in all the websites to identify which sites have WordPress installed. Then and finds the version from the versions.php script. If the version is not equal to the most recent downloaded version (from the code above), it copies the updated source to the website:

for installpath in $(find /webdir -name wp-config.php)
	BASEDIR=$(dirname $installpath)
	INSTALLEDVERSION=$(grep "wp_version =" $BASEDIR/wp-includes/version.php | cut -f 3 -d " " | sed "s/;//" | sed "s/'//g")
		cp -R  ~/src/wordpress/* $BASEDIR/
		echo $BASEDIR "is already" $CURRENTVERSION

Using ajax to query XML in SharePoint Doc Lib, for use in a form’s input autocomplete

Long title, but I wanted to get across what I was trying to do. If I had and XML file in a document library (you could mail enable the doc lib, and send XML from a query in SQL server using the “FOR XML” statement!), could I use jquery to add Autocomplete values to an input field in a newform.aspx? Ended up being not that difficult.

  1. Once the ajax call sucessfully retrievs the xml file, the parseXml routine is called.
  2. Seems there is an issue that IE will not think the file is XML, but rather as txt, so there some quick code to load the file as XML
  3. Then I just look in the file and grab the values I want, and append them to an array
  4. Then just set the array to be used as the autocomplete source
<script type="text/javascript">
$(document).ready(function() {
	type: "GET",
	url: "http://URL/To/xmlfile.xml",
	dataType: ($.browser.msie) ? "text" : "xml",
	success: parseXml
function parseXml(data)
    var xml;
     if (typeof data == "string") {
       xml = new ActiveXObject("Microsoft.XMLDOM");
       xml.async = false;
     } else {
       xml = data;
 	var results = []; 
		var ClientName = $.trim($(this).find('Name').text());
		var ClientCode = $.trim($(this).find('ZipCode').text());
		results[results.length] = ClientName + "(" + ClientCode + ")"

	source: results,
	minLength: 3

Powered by WordPress. Designed by WooThemes