Thursday, November 25, 2010

GoDaddy Coupons

I tried YUP749 and it worked for me! Applied at the very last step, when you are reviewing your shopping card before the final confirmation. Look for "coupon" field at the top right of checkout page.

Good deal, particularly if you are buying 5- or 10- year domains.

FAN3 – 35% off domains Most popular.
FAN749 – 50% off .ORG domains
YUP749 – $7.49 .NET domains
FED749 – $7.49 .BIZ domains

GAM1 – 10% off any order
MIN15 – 15% off any order of $75 or more

GAM2 – $5 off any order $30 or more
FANOFF – $10 off any order $40 or more

PETS20 – 20% off hosting plans of 1yr or more
GAM1 – 10% off month to month hosting
AUCTION12 – 50% off godaddy auction account
FANSSL – 56% off godaddy ssl account ($30 account for $12.99)

Monday, November 22, 2010

How to remove categories slugs in WordPress

WordPress adds default category slug to your blog URLs, so a URL to your category page looks like myblog.org/category/receipts/

You can replace 'category' word with whatever you want, e.g. with 'food', so you'll get
myblog.org/food/receipts/
Better, but still not ideal - what if your blog is not about food only?

Surprisingly, if you completely remove the categories slug in Settings->Permalinks, leaving the field there empty, WP will restore the default 'category' slug back.

I want my categories URLs to look clean -
myblog.org/receipts/
It's better for humans and SEO (these two typically come together).
WP has no option for that, but there is a nice plugin:
WP No Category Base

Simply install it. No configuration required.
Voila! Here are you go: http://photocoupon.net/camera/

Saturday, November 13, 2010

Wordpress with HTTPS/SSL on a custom port

I wasted a few hours trying to configure Wordpress to run on a non-default (not 443) SLL port. Well, it looks it is impossible due to how the WP code is written. Switching from HTTP to HTTPS just replaces the 'http://' URL part with 'https://' part and the port is ignored. The developers assumed that SSL is always on port 443, which obviously can be a huge problem if you are willing to run a few WP with SLL on the same machine.

Playing with .htaccess can not do the trick either. At least I did not found how to do that.

Thursday, November 04, 2010

FULLTEXT search in MySQL DB does not return any result, but works fine in BOOLEAN mode

Well, that was a trap... First, I found that a simple query like
SELECT * FROM `articles` WHERE MATCH(title) AGAINST('jerusalem')
returns 0 rows on my development DB.
Next, I found that the same Native Language SQL query works just fine on the production DB with the real data.
Third, I discovered that the same query works just fine on both DBs when BOOLEAN search is used:
SELECT * FROM `articles` WHERE MATCH(title) AGAINST('jerusalem' IN BOOLEAN MODE)

The reason was that I got only two records in my development DB! So any Natural Language search failed there into the 50% 'common keywords' rule stated in MySQL manual:
A natural language search interprets the search string as a phrase in natural human language (a phrase in free text). There are no special operators. The stopword list applies. In addition, words that are present in 50% or more of the rows are considered common and do not match. Full-text searches are natural language searches if no modifier is given.

With just two rows any keyword was considered by MySQL as common! The obvious solution was adding one more empty row. And voila! - we got the search results.

It looks like this 50% rule can not be switched off by MySQL configuration. If you know how to switch it off drop me a note, would love to do that in my development environment.

Friday, October 22, 2010

Installing WP in a separate folder

Clear instructions by the Wordpress team how to get WP installed in its own directory.

Wednesday, October 06, 2010

Downgrade AWS AMI instance to the new 'micro' AMI

AWS prices for micro AMIs clearly show the costs advantage to run a micro instance for a low-volume site.
Furthermore, you can build the entire scalable IT system on micros, and then just scale up the nodes that have to be scaled.

Unfortunately, migrating to the new micro AMIs it is not that simple. There is no simple way to convert your exiting small or medium AMIs to micros if these AMI were created a while ago and use S3 as their instance store.
You can easily convert your existing AMI to micro using AWS console if your AMI is
a) Linux based
b) EBS (and not 'instance-store'/S3) based. Since 'EBS-root' is quite a new AWS feature many existing AMIs are S3 based, so here the story starts.

If you got a S3-based instance the migration to micro AMI is not that simple.
Of course you can start a new micro instance and install there anything from scratch (it will be automatically created as an EBS instance).
If starting from the scratch is not an option, you can try to follow unofficial guides for converting an S3-based instance to an EBS instance. If the conversion is successful AWS console will allow to create a micro instance from your EBS-hosted AMI.

There are only three blog posts providing some help in S3 to EBS AMI conversion (I did not try any of them yet, none of them looks like an easy way to go):
http://www.elastician.com/2009/12/creating-ebs-backed-ami-from-s3-backed.html
http://www.full360.com/blogs/Migrating-Linux-S3-Based-AMI-EBS-Based-AMI
http://coderslike.us/2009/12/07/amazon-ec2-boot-from-ebs-and-ami-conversion/

I wonder why AWS  did not provide a 'ec2-' tools script and/or console support for these S3-to-EBS-root conversions.

Saturday, September 04, 2010

To see all open (listening) ports in Linux

Run
netstat -ntulp
or
lsof -i -n -P
for some more info

Wednesday, September 01, 2010

Apache/ PHP (XAMPP) does not recognize

Well, when I knew how to write the title of the post I already solved the problem.

After the new XAMPP install with PHP 5.3.4 my PHP code stopped to work, interpreting here and there like plain text. I was not sure what is going on: is that Savant who can not work with PHP 5.3.4 or anything else.

The problem was that this XAMPP install switches off 'short_open_tag' parameter in php.ini. Once I fixed it and restarted Apache everything worked just fine.

Apache (XAMPP) does not start: Virtual Hosts: "Directory path is invalid" - Windows 7

When installing and configuring XAMPP on Windows 7 64-bit I found a few issues.

One well known thing is that Apache fights with Skype for ports 80 and 443, who gets them first.

The solution is simple: just tell Skype not to use ports 80 and 443 - uncheck the box.



Another, a more complicated issue came the next. Once I get Apache running and successfully showing me the XAMPP welcome page, I found that Apache does not run with my virtual hosts file.

On Windows 7 Apache fails with 'path is invalid' message in 'error.log' if some directories are defined as 'Shared' in Windows Explorer. The strange thing that they also could be 'nearby' folders to the path, defined as a virtual host root.

For instance, if I have C:/Development/Project_1 and C:/Development/Project_2, Apache will fail to start with Virtual Host defined in C:/Development/Project_1 if C:/Development/Project_2 is shared.
Weird, but verified - it works this way.
A possible explanation can be that I also have 'Development' shared, so having 'Project_2' shared is like a 'nested-sharing', which obviosly is a nonsense practically speaking, but probably can confuse the OS / Apache. Just a thought.

Now, if you have a fairly complicated folders tree and some folders are defined as shared it's very difficult to find what is going on and what folders disturb you.

The solution:
I just recreated the whole 'Development' tree in a separate folder 'Dev'. Being moved, the folders get a OS warning that sharing will be disabled. The new 'Dev' tree with no folders sharing solves the problem with Apache, and after removing all the old folders I renamed 'Dev' back to 'Development', restoring my previous environment.

Friday, July 02, 2010

Multilingual Wordpress SEO plugin for WPML

It appears that All-in-one-SEO plugin for WordPressdoes can not work with WPML multilingual CMS plugin.
Too bad, since we obviously have to manage our titles, descriptions and keywords in different languages if the pages appear in different languages.
So I had to switched from All-in-one-SEO to something else that supports WPML and can add multilingual titles for multilingual pages, like English title for English pages and Russian titles for Russian pages.

I was told that HeadSpace plugin works fine with WPML. The quick test showed that it is correct.

The bad thing was that I already had added English titles to more than 100 posts and pages using All-in-one-SEO, and this titles did not show up if I use HeadSpace.
What I do now? Should I retype all the titles again for teh new plugin.
I took a quick look on my WordPress database and reviewed the content of "wp_postmeta" DB table. All I needed was just replacing the field's name for title and description!

These 2 lines of SQL convert titles and descriptions from All-in-one-SEO to HeadSpace:


update wp_postmeta set meta_key = replace(meta_key, '_aioseop_title', '_headspace_page_title')
update wp_postmeta set meta_key = replace(meta_key, '_aioseop_description', '_headspace_description')

Saturday, May 15, 2010

Installing SSL certificate on Apache Fedora 8 AWS AMI

First, run
yum install mod_ssl

It actually do most of the work and even more than it is expected by creating ...httpd/conf.d/ssl.conf
Assuming that your Apache httpd.conf configured to include all files from httpd/conf.d, you will get the content of this file automatically.
Modify VirtualHost :443 inculded there, or remove it completly and define your own VirtualHost for port 443.
Note, that you can not keep the default configuration AND define your own - the default from ssl.conf will always overwrite the next one.

 For your HTTPS VirtualHost you will need 4 files:
1. Your DECRYPTED private key file
2. Your certificate, issued by a Certificates Authority
3. Certificate Authority intermidiate server certificate
4. Certificate authority certificate

Your final VirtualHost definition might look like this:

  DocumentRoot /var/www/www.domain.com
  ServerName www.domain.com
      
  SSLEngine on
  SSLProtocol all -SSLv2
  SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM

  SSLCertificateFile /path/ssl/my-certificate.pem
  SSLCertificateKeyFile /path/ssl/decrypted_private_key.pem
  SSLCertificateChainFile /path/ssl/sub.class2.server.ca.pem
  SSLCACertificateFile /path/ssl/ca.pem
  SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
  CustomLog /etc/httpd/logs/ssl_request_log \
      "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"



Once configured, restart Apache:
service httpd restart

If your certificates are OK, you should get a valid response going to your web over SSL:
curl https://localhost

Sunday, April 18, 2010

Log any MYSQL query

It's just about adding one line into my.cnf, like this post suggests.
Note, that you have to add it under [mysqld] secton (and not under 'mysql').

[mysqld]
log=/tmp/mysql.log

With XAMPP, your my.cnf is called just 'my' and is located in [xampp-installation-folder]/mysql/bin
On Unix/Linux take care of log file access permissions by mysqld daemon.

Saturday, February 20, 2010

Export and Import Putty Session Data

The post above provides teh info how you can do it, however the best way seems to be a short command found in comments to the original post.
On source computer run:
regedit /e "%userprofile%\desktop\putty.reg" HKEY_CURRENT_USER\Software\Simontatham

It will create 'putty.reg' file on your Desktop.
Copy it to the destination computer, right-click and select "Merge".
It will import all putty registry data to the new machine.

Worked for me like a charm.

Saturday, January 23, 2010

Adding a network printer to another computer

I bought a new HP 6500 Wireless with WiFi and Ehternet. The installation went smooth, but when I wanted to add it to other computers in my home network no computer could see the printer. At least I did not know how to configure them to see the new network printer. Using "Browse" or "network" options in "Add printer" dialog did not find the HP 6500 device.
This guide show how to configure a MS Windows computer:
http://uis.georgetown.edu/software/documentation/winxp/winxp.network.printer.html

Friday, January 08, 2010

MySQL FULLTEXT search and stopwords

If you are trying too look for a word like 'yours' in the TEXT MySQL field you will never get any result. This is because 'yours' is one of the 'stopwords' ignored in the MySQL searches.
Here is the list of all such stopwords


The bad thing is that this behavior does not change even if you search in BOOLEAN mode. This note describes this as a requested fix for some later MySQL release.

Anyway, if you want to search for just ANY word, without taking in consideration the 'stopwords' list of MySQL, add this line

ft_stopword_file=""


in [mysqld] section of your my.cnf file (for XAMPP on Win xamp-folder/mysql/bin/my - no extension)

Next:
a) restart mysql daemon / service
b) rebuild tables indexes, e.g. by the following SQL comand:

REPAIR TABLE `Texts` QUICK

Now you can search for words like "can", "me" and "you" and - what a surprise! - find the records containing them.