Archive for the Uncategorized Category

testing

Posted in Uncategorized on August 12, 2009 by harryche2008

Free resources, techniques, and tips for goal setting

Posted in Uncategorized on June 21, 2009 by harryche2008

Free resources, techniques, and tips for goal setting to help you achieve all you want in life.
Visit http://www.Goal-Setting-Resources.com

WordPress fix for “Error establishing a database connection”

Posted in Uncategorized with tags on January 27, 2009 by harryche2008

If you have googled everywhere and tried everything, still not working, try this:

change “localhost” to “127.0.0.1″.

It worked for me.

Attachment fu’s “Size is not in the list” problem

Posted in Uncategorized on December 23, 2008 by harryche2008

The fix is to specify :min_size config for has_attachment call:

 has_attachment :content_type => :image,
                 :storage => :file_system,
                 :max_size => 10.megabytes,
         :min_size => 0.kilobytes,
         :resize_to => ‘320×320>’,
                 :thumbnails => { :thumb => ‘126×126>’ }

How to fix “no file to load …” errors when installing Substruct shopping cart code

Posted in Uncategorized on August 26, 2008 by harryche2008

If you’re using substruct, and installing the code following the installation directions given on its website, you may run into problems like “no file to load xxx” errors when trying to initialize the databases by running:

rake substruct:db:bootstrap

The problem is that some of the files that come along with the source have wrong file extention names, like ../extract_options.rb0000644, which really should be ../extract_options.rb, without those weird numbers. I don’t know how it got in there. But once you corrected those file names, then everything should be fine.

Problem with installing Image Science

Posted in Uncategorized on July 30, 2008 by harryche2008

When installing Image Science, it requires FreeImage and Rubyinline. When installing FreeImage, ‘make’ reports some error saying no g++ found.

To install g++, on CentOS, do this:

yum install gcc-c++

Solution to ftp login problem with CentOS vsftp server

Posted in Uncategorized on July 29, 2008 by harryche2008

Sometimes after starting vsftpd service, you still can’t login through ftp. You keep getting errors like:

500 cannot change home directory to …

The problem is with security policy, you need to make sure “Allow ftp to read/write in the user home directories” is checked.

Or, just use

/usr/sbin/setsebool -P ftp_home_dir 1

A few simple ways to debug Javascript code

Posted in Uncategorized on July 25, 2008 by harryche2008

Beyond alert() boxes, here a few very simple ways to debug your javascript code in an Ajax app:

1. Log messages within your js code.
In your html page where js code is running, define perhaps a div for keeping a log of messages that you can append to in your js code, then you can insert this line anywhere in your code, e.g:

$(‘log’).innerHTML += “User entered ” + sUserInput;

Then you can easily show or hide the log by applying a css style to the div tag.

2. Use a logging library, such as Lumberjack or log4js.

3. Venkman debugger

How to run Rails code as a cron job?

Posted in Uncategorized on July 23, 2008 by harryche2008

Rails comes with a script/runner script that can be used to run a specific snippet of code in your Rails app. There’re many ways to organize your code to let this runner script execute it, but one obvious way is to write the code as a model’s action. Here are quick steps for doing this:

1. Insert your code into an action of a model, i.e. MyModel.DoThisThing, DoThisThing must be defined as class method, “def self.DoThisThing…”

2. In your cron job, add a line to run this at certain interval:
/usr/local/bin/ruby /path/to/your/app/script/runner -e production "MyModel.DoThisThing"

Change the ruby path on your system if different.

Loading text(subtitle) as a movie into QuickTime control

Posted in Uncategorized on July 20, 2008 by harryche2008

With working with Apple’s QuickTime Movie control in Visual Studio 2008, you can load a text file as a movie, which is usually used as a subtitle channel added to another video channel.

However, when loading the text file, make sure that the timestamps do not overlap, or not even leave too small an interval between two text lines.

For example:

[00:01:20.45]
Subtitle line 1
[00:01:20.48]
Subtitle line 2

This will not load because the time interval between the two lines is too small, just 0.03 second; the fix is to make the gap bigger, or simply merge the two lines into one, so that they have just one timestamp.