How to remove “Antivirus System Pro” spyware

Posted in Uncategorized with tags on November 15, 2009 by harryche2008

Just this morning when I browsed some sites, my computer got infected by this software program called “Antivirus System Pro”. Spent a little time and finally got rid of it. There is how:

1. Restart Windows XP in safe mode

2. Remove files named “letqsysguard.exe”, and its parent directory “nxbrrd”, or whatever it happens to end up under.

3. Launch regedit, and search for “nsarkinfo”, or just “letqsysguard.exe”, and remove any registry entries that match it.

4. Goto /Windows/system32, and remove a dll called “iehelper.dll”, which hijacks your IE browser whenever you go to a site.

5. Reboot and everything should be back to normal, hopefully.

After throught: perhaps it makes sense to disable Java engine from ever running in your browser, as that seems to be where many spywares get to your system through a web page.

Strange error in running Phusion Passenger

Posted in Ruby on Rails on November 10, 2009 by harryche2008

If you have trouble starting passenger for your Rails application, check your httpd log file, usually at /var/log/httpd/error_log for something looks like this:

*** Passenger ERROR (ext/common/ApplicationPoolServer.h:643):
Cannot execute /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/ApplicationPoolServerExecutable: Permission denied (13)

The solution is to run:

setenforce Permissive

or

/usr/sbin/setenforce Permissive

You may learn more about this at http://aproxacs.blog.qrobo.com/tag/selinux/

Problem with installing Passenger (mod_rails)?

Posted in Ruby on Rails on September 3, 2009 by harryche2008

A common problem you may find when installing passenger is it can’t find the APR development headers. A quick fix worked for me is to run:

export APXS2=/usr/local/apache2/bin/apxs

then everything works just fine.

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

How to use Permalinks on WordPress blog

Posted in wordpress on March 18, 2009 by harryche2008

Permalinks are useful for SEO purposes. To enable it:

1. In your /wp-admin page, go to Settings -> Permalinks to choose the format you want.

2. Create a .htaccess file in your wordpress root directory, and update its content with whatever wordpress instructed when you change Permalinks options.

Ruby code to convert country name to 2-letter code

Posted in Ruby on Rails on February 17, 2009 by harryche2008

You probably need this if you use Rails country_select helper for your country dropdown list. Many API requires a 2-letter country code instead of country names. Here is a piece of code can do just that:


# convert country name to country code
COUNTRY_CODES = {
'AF'=>'Afghanistan',
'AL'=>'Albania',
'DZ'=>'Algeria',
'AS'=>'American Samoa',
'AD'=>'Andorra',
'AO'=>'Angola',
'AI'=>'Anguilla',
'AQ'=>'Antarctica',
'AG'=>'Antigua And Barbuda',
'AR'=>'Argentina',
'AM'=>'Armenia',
'AW'=>'Aruba',
'AU'=>'Australia',
'AT'=>'Austria',
'AZ'=>'Azerbaijan',
'BS'=>'Bahamas',
'BH'=>'Bahrain',
'BD'=>'Bangladesh',
'BB'=>'Barbados',
'BY'=>'Belarus',
'BE'=>'Belgium',
'BZ'=>'Belize',
'BJ'=>'Benin',
'BM'=>'Bermuda',
'BT'=>'Bhutan',
'BO'=>'Bolivia',
'BA'=>'Bosnia And Herzegovina',
'BW'=>'Botswana',
'BV'=>'Bouvet Island',
'BR'=>'Brazil',
'IO'=>'British Indian Ocean Territory',
'BN'=>'Brunei',
'BG'=>'Bulgaria',
'BF'=>'Burkina Faso',
'BI'=>'Burundi',
'KH'=>'Cambodia',
'CM'=>'Cameroon',
'CA'=>'Canada',
'CV'=>'Cape Verde',
'KY'=>'Cayman Islands',
'CF'=>'Central African Republic',
'TD'=>'Chad',
'CL'=>'Chile',
'CN'=>'China',
'CX'=>'Christmas Island',
'CC'=>'Cocos (Keeling) Islands',
'CO'=>'Columbia',
'KM'=>'Comoros',
'CG'=>'Congo',
'CK'=>'Cook Islands',
'CR'=>'Costa Rica',
'CI'=>'Cote D\'Ivorie (Ivory Coast)',
'HR'=>'Croatia (Hrvatska)',
'CU'=>'Cuba',
'CY'=>'Cyprus',
'CZ'=>'Czech Republic',
'CD'=>'Democratic Republic Of Congo (Zaire)',
'DK'=>'Denmark',
'DJ'=>'Djibouti',
'DM'=>'Dominica',
'DO'=>'Dominican Republic',
'TP'=>'East Timor',
'EC'=>'Ecuador',
'EG'=>'Egypt',
'SV'=>'El Salvador',
'GQ'=>'Equatorial Guinea',
'ER'=>'Eritrea',
'EE'=>'Estonia',
'ET'=>'Ethiopia',
'FK'=>'Falkland Islands (Malvinas)',
'FO'=>'Faroe Islands',
'FJ'=>'Fiji',
'FI'=>'Finland',
'FR'=>'France',
'FX'=>'France, Metropolitan',
'GF'=>'French Guinea',
'PF'=>'French Polynesia',
'TF'=>'French Southern Territories',
'GA'=>'Gabon',
'GM'=>'Gambia',
'GE'=>'Georgia',
'DE'=>'Germany',
'GH'=>'Ghana',
'GI'=>'Gibraltar',
'GR'=>'Greece',
'GL'=>'Greenland',
'GD'=>'Grenada',
'GP'=>'Guadeloupe',
'GU'=>'Guam',
'GT'=>'Guatemala',
'GN'=>'Guinea',
'GW'=>'Guinea-Bissau',
'GY'=>'Guyana',
'HT'=>'Haiti',
'HM'=>'Heard And McDonald Islands',
'HN'=>'Honduras',
'HK'=>'Hong Kong',
'HU'=>'Hungary',
'IS'=>'Iceland',
'IN'=>'India',
'ID'=>'Indonesia',
'IR'=>'Iran',
'IQ'=>'Iraq',
'IE'=>'Ireland',
'IL'=>'Israel',
'IT'=>'Italy',
'JM'=>'Jamaica',
'JP'=>'Japan',
'JO'=>'Jordan',
'KZ'=>'Kazakhstan',
'KE'=>'Kenya',
'KI'=>'Kiribati',
'KW'=>'Kuwait',
'KG'=>'Kyrgyzstan',
'LA'=>'Laos',
'LV'=>'Latvia',
'LB'=>'Lebanon',
'LS'=>'Lesotho',
'LR'=>'Liberia',
'LY'=>'Libya',
'LI'=>'Liechtenstein',
'LT'=>'Lithuania',
'LU'=>'Luxembourg',
'MO'=>'Macau',
'MK'=>'Macedonia',
'MG'=>'Madagascar',
'MW'=>'Malawi',
'MY'=>'Malaysia',
'MV'=>'Maldives',
'ML'=>'Mali',
'MT'=>'Malta',
'MH'=>'Marshall Islands',
'MQ'=>'Martinique',
'MR'=>'Mauritania',
'MU'=>'Mauritius',
'YT'=>'Mayotte',
'MX'=>'Mexico',
'FM'=>'Micronesia',
'MD'=>'Moldova',
'MC'=>'Monaco',
'MN'=>'Mongolia',
'MS'=>'Montserrat',
'MA'=>'Morocco',
'MZ'=>'Mozambique',
'MM'=>'Myanmar (Burma)',
'NA'=>'Namibia',
'NR'=>'Nauru',
'NP'=>'Nepal',
'NL'=>'Netherlands',
'AN'=>'Netherlands Antilles',
'NC'=>'New Caledonia',
'NZ'=>'New Zealand',
'NI'=>'Nicaragua',
'NE'=>'Niger',
'NG'=>'Nigeria',
'NU'=>'Niue',
'NF'=>'Norfolk Island',
'KP'=>'North Korea',
'MP'=>'Northern Mariana Islands',
'NO'=>'Norway',
'OM'=>'Oman',
'PK'=>'Pakistan',
'PW'=>'Palau',
'PA'=>'Panama',
'PG'=>'Papua New Guinea',
'PY'=>'Paraguay',
'PE'=>'Peru',
'PH'=>'Philippines',
'PN'=>'Pitcairn',
'PL'=>'Poland',
'PT'=>'Portugal',
'PR'=>'Puerto Rico',
'QA'=>'Qatar',
'RE'=>'Reunion',
'RO'=>'Romania',
'RU'=>'Russia',
'RW'=>'Rwanda',
'SH'=>'Saint Helena',
'KN'=>'Saint Kitts And Nevis',
'LC'=>'Saint Lucia',
'PM'=>'Saint Pierre And Miquelon',
'VC'=>'Saint Vincent And The Grenadines',
'SM'=>'San Marino',
'ST'=>'Sao Tome And Principe',
'SA'=>'Saudi Arabia',
'SN'=>'Senegal',
'SC'=>'Seychelles',
'SL'=>'Sierra Leone',
'SG'=>'Singapore',
'SK'=>'Slovak Republic',
'SI'=>'Slovenia',
'SB'=>'Solomon Islands',
'SO'=>'Somalia',
'ZA'=>'South Africa',
'GS'=>'South Georgia And South Sandwich Islands',
'KR'=>'South Korea',
'ES'=>'Spain',
'LK'=>'Sri Lanka',
'SD'=>'Sudan',
'SR'=>'Suriname',
'SJ'=>'Svalbard And Jan Mayen',
'SZ'=>'Swaziland',
'SE'=>'Sweden',
'CH'=>'Switzerland',
'SY'=>'Syria',
'TW'=>'Taiwan',
'TJ'=>'Tajikistan',
'TZ'=>'Tanzania',
'TH'=>'Thailand',
'TG'=>'Togo',
'TK'=>'Tokelau',
'TO'=>'Tonga',
'TT'=>'Trinidad And Tobago',
'TN'=>'Tunisia',
'TR'=>'Turkey',
'TM'=>'Turkmenistan',
'TC'=>'Turks And Caicos Islands',
'TV'=>'Tuvalu',
'UG'=>'Uganda',
'UA'=>'Ukraine',
'AE'=>'United Arab Emirates',
'UK'=>'United Kingdom',
'US'=>'United States',
'UM'=>'United States Minor Outlying Islands',
'UY'=>'Uruguay',
'UZ'=>'Uzbekistan',
'VU'=>'Vanuatu',
'VA'=>'Vatican City (Holy See)',
'VE'=>'Venezuela',
'VN'=>'Vietnam',
'VG'=>'Virgin Islands (British)',
'VI'=>'Virgin Islands (US)',
'WF'=>'Wallis And Futuna Islands',
'EH'=>'Western Sahara',
'WS'=>'Western Samoa',
'YE'=>'Yemen',
'YU'=>'Yugoslavia',
'ZM'=>'Zambia',
'ZW'=>'Zimbabwe'
}

class String
  def to_country_code
    COUNTRY_CODES.index(self)
  end

end

 

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 make absolute positioning work correctly

Posted in CSS and Ajax on December 13, 2008 by harryche2008

Absolute position is a very convenient way to align and postion elements within a div section, such as navigation tabs in a header, etc. However, one must remember to specify the containing block’s position property to make it really work.

For example, this is the code for my navigation menus inside a header div, my intention was to put nav tabs at the bottom right of the header box:

<div id="header">
<ul id="nav-tabs">
<li><a href="/">Home</a></li>
<li><a href="/">Page1</a></li>
<li><a href="/">Page2</a></li>
</ul>
</div>

And now my css looks like this:

div#header {
  margin: 0 auto
  width: 900px;
  height: 120px;
  background: url(/images/header-background.gif) repeat-x;
}
ul#nav-tabs {
 position: absolute;
 bottom: 2px; right: 0px;
 height: 41px;
}

Notice I used “position: absolute” for the nav tabs <ul> tag, but it didn’t work, for it showed up at the bottom right of the whole screen, not within just the header.

The fix is to add “position: relative” to the div#header style, then it all works just as expected.

Hope that helps if you have the same problem with absolute positioning.