Archive for the 'Misc' Category

Page 2 of 2

How to make people click ads on your blog?

Even if you have really big traffic on your site it does not mean that you will get tons of clicks to your ads (google adsense or any other). You may believe me or not but there are a few ways you may increase clicks to your ads without breaking any ad program rules... Some people just put ads anywhere on their site and are waiting for a huge revenue. But it does not work this way. You need to know what are you doing or you will have to learn it from your own mistakes and loose a lot of time.

Continue reading...

Top 10 Articles About Blog Promotion You Should Read

How to promote my blog? How to get more traffic? What should I do to get more readers? I am sure that you ask this questions to yourself all the time. Probably it's the reason why you are reading my post. There are tons of articles about it in the Internet and I have chosen top 10 that are really worth reading.

Continue reading...

How to make WordPress “Page” link to any url

Today I have been looking for solution for making one of my "page" links linking to category of posts for one of my WordPress projects. I have found a few tips about putting "href" tags in description etc. But it have broken my layout.

Then I have found great WordPress plugin called "Page Links To" that would let you put any URL instead of your real page content (even external!). When you install it you get additional field in your Add New Page section where you can put your url. For me it works like a charm!

Problem with 404 error on /wp-admin/ in WordPress

I have just been moving my blog to new host. Everything was fine after I did it as described at WordPress Codex except admin panel.

When I was trying to login to Dashboard I got 404 error. There is one very simple solution for it. When I was moving files from my old host my ftp client set chmod of /wp-admin/ directory to 775. It won't work with this permission. All you need to do is to change it to 755 and it should be working again.

MySQL login details in WordPress

If you have decided to move a copy of your wordpress to other host propably you will have problem with your mysql login details. Even if mysql database name, login and password are same - propably you will have to change login host (until it is not localhost :) ). It is very easy to do. All you need to change after you copy WordPress script to your new account is to edit wp-config.php file. Open it in any text editor (Notepad would be ok), find and edit following lines:

define('DB_NAME', 'put_db_name_here');
define('DB_USER', 'put_db_login_here');
define('DB_PASSWORD', 'put_db_password_here');
define('DB_HOST', 'put_mysql_host_here');

And that's all :)

WordPress K2 theme and problem with comments (solution)

Since I have upgraded a WordPress to version 2.8 I have seen new comments counted by Akismet plugin but nothing in spam queue nor any comments to approve. It looked very strange for me!

I have logged out from my blog admin and tried to post a comment. After submitting it I saw a blank page!

The worst thing was that I have not found any solutions in google (and people say that google always knows the answer :)) - so I decided to upgrade K2 Theme... But there is now new release on their main page!

But wait! There is a solution! (or I would not write this post :)) After some googling (ok... please forget what I wrote about google before... :D) I have found K2 nightly build subpage... All you need to do to fix this issue is to upgrade K2 with nightly build. It can be downloaded from: http://getk2.com/nightly/.

I have decided to download last RC8 version (k2-1.0-RC8-revision-807-2009-07-13.zip). And now you can test if comments are working again :)

PROFTPD virtual user – quick howto

It was boring to look for it in PROFTPD docs - but I could not find quick FAQ, so I had no choice. Anyway I decided to write it for others who need quick tip. Here are 4 simple steps to create virtual user account.
Continue reading...

Form element name change with JavaScript and radio button

Today I have had to modify very complex script to change look of html form. It is quite easy to make changes in the form. But sometimes it is a problem to modify not to well written PHP script to receive data from new form.
Continue reading...

Sort VARCHAR as INT in MySQL query

If you need to sort varchar data as int, there is one very nice function in MySQL. Problem I had to solve was to sort values as below in a human logical way. Values were similar to this (and I wanted it to be sorted like below):

1; 2; 2a; 3; 4; 5; 5a; 5b; 5c; 6; 7; 11; 14; 14a; 16;

The problem was that if I put this data to MySQL database as varchar and sort by this column, MySQL returned it this way:

1; 11; 14; 14a; 16; 2; 2a; 3; 4; 5; 5a; 5b; 5c; 6; 7;
Continue reading...

How to enable error reporting in PHP script

If error reporting is disabled by default on your host you have two solutions.
First is to add to your PHP script this little piece of code:

<!--?php 
  error_reporting(E_ALL);
  ini_set("display_errors", 1);
  // the rest of your script...
?-->

Additionally it is very useful to enable E_STRICT reporting level as well (not included in E_ALL). E_STRICT run-time notices, enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. To turn it on your code should look like this:

<!--?php 
  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);
  // the rest of your script...
?-->

But putting this code on the top of your script will not catch any parse errors. A missing ")" or ";" will still lead to a blank page. This is because the entire script is parsed before any of it is executed. If you are unable to change php.ini (that would be the best solution) and set in it

display_errors On

then there is a possible workaround (found on comments on php.net website). This code would solve this problem:

<!--?php 
  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);
  include("file_with_errors.php");
?-->

You may go even further and make a little debug script with error reporting (when it is disabled for the rest of your scripts). Just create a file called "debug.php" with this content:

<!--?php 
  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);
  include($_GET["file"]);
?-->

Then you will be able to execute any script on your web host just by calling "debug.php" with urls like this
http://domain.com/folder/debug.php?file=file_with_errors.php
http://domain.com/folder/debug.php?file=subfolder/file_with_errors.php
http://domain.com/folder/debug.php?file=../file_with_errors.php

Second alternative soulution is to edit your .htaccess file. It would enable error reporting for all files in current directory. All you need to do is to simply add the following lines:

php_value display_errors 1
php_value display_startup_errors 1