Archive

Archive for March, 2008

Textmate links, Firefox and Linux

March 22nd, 2008 No comments

Various Ruby frameworks, including Ramaze and Merb, display error pages with TextMate links. While TextMate is Mac-only, Linux users can still use the links to launch Vim with the following steps.

1. Create /usr/local/bin/firefox-txmt with the following:

#!/usr/bin/env ruby

unless ARGV[0] =~ /^txmt://open?url=/ then
	puts "You probably want this called from firefox with a txmt url."
	exit 1
end

args = ARGV[0].split("://")

file = args[2].split("&")[0]
line = args[2].split("line=")[1]
line = "1" if line == "?"

`x-terminal-emulator -e vim #{file} +#{line}`

2. Create a key in about:config called network.protocol-handler.app.txmt, and set it’s value to firefox-txmt.

This tip came from Lindsay Holmwood’s blog. He also suggests these changes to .vimrc:

se cursorline
hi CursorLine term=none cterm=none ctermbg=1

Some more Vim stuff here.

Categories: Uncategorized Tags:

Globalization Made Easy

March 18th, 2008 No comments

Here are two unbelievable sources for just about anything imaginable:

https://www.alibaba.com
https://www.ec21.com

The breadth and depth of available products is simply breathtaking.
For example:
a rather disconcerting network management device
tiny Geode pc (like Soekris?)
or just cute pc

With the speed this stuff moves, I don’t expect the above links to last long! 😉

Categories: Uncategorized Tags:

Example Linux chkconfig/init Script

March 18th, 2008 2 comments

From Cliff Pearson’s excellent system administration blog:

<<begin quote>>

From time to time, people want me to create LINUX init scripts for them. I usually just take an existing one for another service and change it up to work for my new application, but most of them have become so long these days that I end up having to hack out a ton of code just to reduce them down to the very basic script I need. I decided to create this very simple template so I wouldn’t have to keep trimming down the more complex scripts that one tends to find in /etc/init.d these days.

This script is chkconfig compatible, so call it the name of your new service and put it in /etc/init.d

The chkconfig: 235 section indicates the the default runlevels. For instance, if we called this script /etc/init.d/new-service and ran chkconfig new-service on, it would be active in runlevels 2,3 and 5.

The 98 and 55 numbers indicate the order of startup and kill. This means that using this tag, the startup symbolic link would be named S98new-service and the symbolic link to kill the process would be named K55new-service.

#### SNIP ####

#! /bin/sh
# Basic support for IRIX style chkconfig
###
# chkconfig: 235 98 55
# description: Manages the services you are controlling with the chkconfig command
###

case "$1" in
  start)
        echo -n "Starting new-service"
        #To run it as root:
        /path/to/command/to/start/new-service
        #Or to run it as some other user:
        /bin/su - username -c /path/to/command/to/start/new-service
        echo "."
        ;;
  stop)
        echo -n "Stopping new-service"
        #To run it as root:
        /path/to/command/to/stop/new-service
        #Or to run it as some other user:
        /bin/su - username -c /path/to/command/to/stop/new-service
        echo "."
        ;;

  *)
        echo "Usage: /sbin/service new-service {start|stop}"
        exit 1
esac

exit 0

#### /SNIP ####

Obviously change all instances of “new-service” to the name of your actual service… Enjoy!

<< end quote >>

Installing Ruby 1.8.6 on CentOS-5

March 18th, 2008 7 comments

I don’t know how much difference it makes but since I use Ruby 1.8.6 under Ubuntu for development, I prefer to use the same version in production on Centos. Unfortunately, CentOS-5.1 still comes with version 1.8.5.

Fortunately, someone has kindly gone to the trouble of building CentOS-5.1 rpms.

From centos.org:

Jacek (wolk at jablko.one.pl) rebuilt a few ruby-1.8..6 rpms from fedora under Centos 5.1. His yum repo is avilable at: https://repo.premiumhelp.eu/ruby/

To use with yum, create /etc/yum.repos.d/ruby.repo and add the following:

[ruby]
name=ruby
baseurl=https://repo.premiumhelp.eu/ruby/
gpgcheck=0
enabled=0

————————————————————————–
Sample usage:
#yum –enablerepo=ruby list *RUBY*
Thanks to Jacek

Categories: Uncategorized Tags:

WordPress Backup

March 18th, 2008 No comments

While the WordPress export funtion is better than nothing, the proper way to backup your WP site is to dump the underlying SQL database. Instructions on how to do this are here.

Categories: Uncategorized Tags:

WTL::CRichEditCtrl

March 12th, 2008 No comments

This was a time waster: I had a simple dialog-based application which happened to include a RichEdit control. But every time the program launched, the wizard created Run function printed “Main dialog creation failed!” and stopped. Everything would work fine until I added a RichEdit control.

Finally I found that adding the following to my _tWinMain resolved the issue:

HINSTANCE hInstRich = ::LoadLibrary(CRichEditCtrl::GetLibraryName());

Unfortunately I forgot that Rich Edit isn’t a common control and is not initialized with InitCommonControlsEx. As far as I know, this is the only control supported in the VS dialog editor that needs its own LoadLibrary.

Categories: Uncategorized Tags:

Centos – Add GUI Post-Install

March 3rd, 2008 3 comments

Ever wanted to add Gnome (or anything else) after installing a text-mode Centos? Here’s how:

Get a list of available package groups:

# yum grouplist
Loading "installonlyn" plugin
Setting up Group Process
Setting up repositories
Installed Groups:
Editors
System Tools
...
Available Groups:
Office/Productivity
GNOME Software Development
GNOME Desktop Environment
KDE Software Development
KDE (K Desktop Environment)
Server Configuration Tools
Administration Tools
...
Done
#

So to install Gnome:

yum install "GNOME Desktop Environment"

And go get a coffee.

Categories: Uncategorized Tags: