Tuesday, 29 April 2014

Running WAMP on Windows 8 alongside IIS - 403 Forbidden Index

Problems with WAMP on Windows 8 - Forbidden 403 - Running IIS and Apache side by side

By Strictly-Software

I have just got a new laptop which has come with Windows 8.1.

Thankfully this version of Windows gives me more of  a Windows 7 feel as I really hate those big tablet like buttons. I can't use them as a touch screen anyway and I code not spent all my time on Facebook so they give me no benefit.

I want to get where I am going without Windows telling me how things should look and feel and Windows 8 is numptyfing the user interface even more so that old people can buy their wool with a few swipes but a coder has to hack about for ages to get anything working.

Anyway as I develop in PHP and C#, ASP I need to run both IIS and WAMP side by side on the same PC.

If you have read my earlier article on getting round issues with IIS blocking port 80 you will know that I like to change the port Apache uses to 8888 (a common HTTP alternative) so that I can run both web servers side by side without having to switch IIS off before switching WAMP on and vice versa.

Quick overview is to edit the httpd.conf file and change the listen port from 80 to 8888 e.g

Listen 8888

Also changing the line that mentions the server to:

ServerName localhost: 8888

You can read this article here. Troubleshooting WAMP Server on Windows 7

However with Windows 8 I found this didn't fix the problem and when I tried to access localhost:8888 I would get a Forbidden 403 status error code back when accessing index.php or phpmyadmin.php.

Apparently there are multiple solutions depending on what you want to do with your server.

As Windows 8 is an IPv6 Operating system and WAMP is IPv4 the loopback address is NOT 127.0.0.1 but ::1.

A simple ping to localhost in your command prompt will prove this as you will get back ::1 and not 127.0.0.1.

To fix this problem there are two solutions depending on whether you want to run IIS alongside WAMP. If you don't mind toggling between IIS and WAMP then follow Method 1. If not try Method 2.

Method 1

To get round the differences between WAMP being IPv4 and Windows 8 being IPv6 you need to edit some files.

Instead of changing your httpd.conf file as my previous article does you change the following line.

Listen 80

to

Listen 0.0.0.0:80

Then you would need to edit your hosts file in c:\windows\system32\drivers\etc to comment out the line ::1 localhost e.g:

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
# ::1                   localhost

However this doesn't stop the issue of running WAMP alongside IIS.

Therefore if you do want both to run side by side without toggling them on/off ignore what I just said and instead follow method 2.

Method 2

Follow all my steps in the earlier article: Troubleshooting WAMP Server on Windows 7 and then you need to also change the following lines of code in your phpmyadmin.conf file which will be in your c:\wamp\alias\ folder to the following:



<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
 Deny from all
 Allow from all
</Directory>


And then in your C:\wamp\bin\apache\apache2.2.22\conf\httpd.conf file (or whatever version you are using) you need to have these lines of code.

Remove the allow from 127.0.0.1 and replace with allow from all like we did in the previous file.


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>


Now you should be able to access phpmyadmin with either http://localhost:8888/phpmyadmin/ or http://127.0.0.1:8888/phpmyadmin/ and still get your .NET or ASP classic code running with IIS from a simple http://localhost or http://127.0.0.1.

These two methods should sort you out if you get stuck like I did and I am sure when the next version of Windows comes out we will all have some more problems to solve to get WAMP running alongside IIS!

Friday, 18 April 2014

How to send a developer USEFUL information - Debugging Strictly AutoTags

How to send a developer USEFUL information - Debugging Strictly AutoTags

By Strictly-Software

I understand that a lot of people who use CMS systems like Joomla or WordPress don't know how to code otherwise they would be using proper code they had written themselves.

However most people don't know how to code and therefore they install plugins and themes that they download for free and then expect them to do everything they want and more. On top of that they expect instant free support.They don't seem to realise that:
a) A developers time is not spent just working for free on open source projects
b) A donation for time spent fixing a problem that is only apparent to the user in question would be nice at the very least.
c) A developer cannot fix a problem  on a server across the world without:
   -Access to their system or website e.g logins, FTP, SSH, Database etc.
   -Information about the problem and how the developer can go about replicating it to fix it.

If the developer cannot replicate the problem then how on earth are they supposed to be able to fix it for you?

Therefore the first thing you should do if you have a problem with 3rd party code is check to see if other people have had the same PROBLEM and whether the same SOLUTION works for you.

It may be you are asking a common rookie mistake that many previous people have done before and all you need to do is find out from those people what they did to fix it.

However if a search of Google, BING, Techie Forums like stackoverflow.com and others does not reveal an answer then you should go through a step by step guide to narrow down the problem before contacting the developer in question. Believe it or not they do have lives and don't live to fix other peoples bugs.

Below I have reproduced one the debug notes I give out to my WordPress plugin users for one of my own plugins Strictly AutoTags, It should be used as a guide when you are asking for help but please note some questions are plugin specific.

However in general the steps are useful for ALL plugins or problems and therefore they should be read by all WordPress users. 

This step by step routine should ALWAYS be followed by the user before even thinking of emailing me. Also if I do find a problem and fix it for you then some kind of appreciation would be nice e.g a donation would not go a miss.

Steps to narrowing down your problem with a WordPress plugin


1. If you add a post but no tags are added then it does not mean the plugin is not working just that no tags could be found to associate with the post.

2. Test the plugin is working by creating a new post with the following content and saving it as a draft (this is relevant to Strictly AutoTags and may not be needed with your own problem) :

Article Title:
The CIA now admits responsibility for torture at Guantanamo Bay
Content Body:
Today the CIA admitted it was responsible for the recent accusations of torture at Guantanamo Bay.
Billy Bob Johnson, the chief station manager at the Guantanamo Bay prison said that the USA had to hold its hands up and admit that it had allowed its CIA operatives to feed the prisoners nothing but McDonalds and Kentucky Fried Chicken meals whilst forcing them to listen to Christian Rock Music for up to 20 hour periods at a time without any break.
The CIA apologised for the allegations and promised to review its policy of using fast food and Christian Rock Music as a method of torture.

3. Save the draft post and check the number of tags that get added. The plugin should have found a number of words to use even if you have no existing saved tags in your site. It is always best to save the article as a draft, check which tags have been used, remove or add any yourself before publishing an article.

4. Some people have complained that they have added words to the stop/noise word list which still get tagged and think the plugin is broken. This is not the case and the problem is usually that the user hasn't removed any new noise words from the system first BEFORE re-scanning. The noise words are only used in the auto discovery stage of the auto tagging and if tags have already been saved in the system then the site will use them in it's relevancy check whether or not they have been marked as noise words. Version 2.0 has a new option to aid the easy removal of noise words from the saved post tag list and this option should be run whenever new noise words are added.

5. If you have articles with lots of capital words in the title e.g THIS IS A TEST ARTICLE or body then set the Ignore Capital Percentage to a level appropriate for your site. Otherwise words will be treated as acronyms when they shouldn't.

6. If you don't want the plugin to hunt out possible new tags for your site then turn Auto Discovery OFF. Then only existing saved post tags will be used to find relevant tags in new articles.

7. Auto Discovery will find new possible words to use as tags using the settings you give it so set them carefully. However if these new words are not found to be relevant to your article they won't get saved against the post OR in the system. Use the Rank Title and Rank HTML options to ensure words in the post title or already in special formatting HTML such as headers or strong tags are considered more relevant than other words.

8. If you have any problems make sure it not related to Wordpress, your server/hosting or other plugins before requesting support.

9. Please check existing support tickets before writing a new support ticket as the problem may have already been answered.

10. Always disable all other plugins and leave just Strictly AutoTags on before considering it the likely cause of a problem.

11. If you are going to write a new support question that hasn't already been answered can you please provided the following information all which can be got from your host, WP, plugins, DB or a combination of  all.

12. Download the wp-config.php file from your server, edit it and turn the constant WP_DEBUG to TRUE and re-upload e.g

define('WP_DEBUG', false);

define('WP_DEBUG', true);

It will mean your visitors see a lot text all over the screen but it will also help you find any critical errors.

Notices and Warnings do not matter as much. But if you see anything Critical or Erroring - take note to supply the developer with.

If nothing is notable return it to FALSE ASAP!

For example load a version of phpinfo.php onto your server but call it something else so hackers cannot guess it e.g my-3467phpINF.php this way you can see what your server has installed but they can't!

It is very important you tell the developer all of the following information so they know what they are working with.


  1. Version of PHP (or other language) you are running (make sure it's compatible with the code)
  2. Version of MySQL (or other database system) you are running (make sure it's compatible with the code)
  3. Any error message you get when you run the routine that breaks.
  4. The time it takes to run before breaking.
  5. If you can hit F12 and view the console any Nework/JavaScript errors you may have - also if you have lots of 404's due to missing files fix those as that will cause overhead. If you don't have them just create blank file with the same name.
  6. If you can code, turn on the debug constant in the plugin, change your IP in the MyIP function to your own IP address (just type "What is my IP" into Google to get a value, re-upload the file (after backing up) and send me the output of the debug.
  7. If you have lots of browser add-ons try it in a fresh install of a new browser, e.g download Opera/Safari for windows and test it on that.
  8. If possible install HTTP Fox on FireFox, open it, and then press play just before doing the action that causes the problem. This will give you all the HTTP requests and responses from the server. Look for any 500 status codes or errors. Send me anything unusual - and only related to my site/plugin as it will also record all the plugin guff from your FireFox extensions as well.
  9. The more information the better, so screeen shots, video casts (free online, click play, do action, stop, send link etc).and step by step guides of what YOU did to reproduce the problem will help.
  10. How many articles are on your site?
  11. Is it a big or small site?
  12. Do you get hacked a lot?
  13. What were the last errors in your hosts error_log (available through VMIN and SSH e.g PUTTY using a less command on the error log)

So although there is more you can do this should be the first things you do when you notice an issue with your code.

Please remember developers are NOT mind readers. So sending in emails or messages like

"When I do X nothing happens"

of

"When I hit the send button it breaks"

Are more than useless.

Please help a developer have a break! And thank them with more than words if they do spend all day and night helping you!

Thanks

Buy Strictly AutoTags NOW!

Remember there ids a PRO version of Strictly AutoTags which you csn buy from etsy.com or my own site.

For only £40 you get all the normal features plus:



Buy Now

  • The ability to match on tag but tag another.
  • Set up your "TOP TAGS" whih wil be ranked above all overs.
  • Turn text links like www.strictly-software.com into real clikable links like www.strictly-software.com.
  • Remove old HTML like B and I and replace them with modern tsgs like E and I.
  • Set limits on the 

Wednesday, 16 April 2014

Please Don't Upgade to Wordpress 3.9!

Please Don't Upgade to Wordpress 3.9!

I have just been sent this email by WordPress telling me of the changes they are making.

As some of these changes have not been made in my plugins and you DO upgrade to WordPress 3.9 and any of my plugins break e.g

Strictly AutoTags
Strictly TweetBot
Strictly Google Sitemap (no longer supported)
Strictly Content Cleaner
Strictly System Check

Then you WILL HAVE problems due to code they are now using not being in the plugins.

I wanted a quite Easter Weekend not one spend coding!

So if you do get problems by upgrading it's your own fault for not following my blog!


Buy Now


Monday, 31 March 2014

Beware of the REL NOFOLLOW Scam

Beware of the REL NOFOLLOW Scam

By Strictly-Software

For those of you who sell articles or blogs to people you should be aware of a scam I have been caught in twice now.

I call it the rel nofollow scam as it basically means people get link juice from your site without paying for it.

The scam goes like this.
  1. Someone offers to pay you £$ for an article to appear on your site. Usually with good PR. 
  2. They send the article which has links to their own site in it one or more times. There is NO rel="nofollow" on these links. 
  3. They say it will take 3 days to pay you so you put the article up. 
  4. 7 days later you are chasing them for the money as it hasn't been sent to you. 
  5. They then make some sort of excuse why they cannot pay you and say "take the article down". Which of course you do. 
  6. However unbeknown to you they have already obtained what they wanted, which was BOTS like GoogleBOT, BING and so on, to crawl the article and then follow the link to their site passing on the link juice from your site. 
  7. Believe it or not the benefits of this link juice being passed stays around long after the article exists. 
  8. So you have basically been ripped off as they have got their PR and link juice and you haven't received a nickel.

Don't Believe Me?

At my company that makes Job Boards we used to do tests to prove to our boss we could get to number 1 on Google for a one page Job Board for long tail terms like "latest jobs in CSS" or "latest London jobs in SQL".

We did this by turning on a switch that at night made sure every major SERP BOT (GoogleBOT, BING) saw different banner links, alt and title values than normal.

Because we had hundreds of Job Boards it looked as if they were all pointing up at our magnificent Job Board.

This was in the days where the number of backlinks was king and SEO companies selling links from directories was the main thing SEO companies did.

So we were testing features for "boosting" a sites Page Rank through linkage systems.

This wasn't the "illegal" GoogleBOT masking method of showing different content to humans and then to robots.

The reason is that banners rotate anyway and the href, alt and title values will change naturally anyway.

If you refreshed most sites with banners they will rotate and show different images than the page load before.

If all these sites were all breaking the GoogleBOT masking rule no site would be able to rotate banners.

So to a SERP BOT it looked like our one site Job Board was sitting at the top of a pyramid with 200+ high PR Job Boards all passing link juice our way. Basically saying although we have good PR, this site is better than us (in basic terms).

Also a mate who had an online T-Shirt company that was ranking nowhere on Google turned this "feature" on for a weekend, changing the TITLE and ALT attribute values to all have multiple long tail keywords within them.

Here is an example of a multiple long tail stuffed attribute:

"Buy the best XX T-Shirts from XX company, the best looking XX T-Shirts by company XX. Buy XX T-Shirts now for rock bottom prices! Sale now on at XX Company" 

Within a week he was on the top of the first page of Google! 

Also even though the "tweak" was turned off after a few days the benefit he got from all these sites linking to him over just a couple of days lasted for ages.

He was still on the top page of Google many months later!

Even after we turned this Job Board feature off the one page jobboard stayed at the top of Google for months later for our desired keywords.

The algorithms may have changed by now for BOTS but the idea of passing juice along to sites with higher "domain authority" than you still exists.

The ideal SEO situation for a site linking to you is this.

A site with a homepage where there is only one link on it which points at your site.

This is basically telling the SERPS that your site is "better" than them e.g it has more site/domain authority than them.

Plus as their homepage only has a single link on it (the most important page on a site) and this link goes to YOUR SITE then they are telling the SERP BOTS that crawl it that this other site MUST be very important.

The original PR algorithm is below. It is probably much more complex now and SERPs use responsive site designs, social media and load speed a lot more in weighting the "worth" of a site when ranking it.

PR(A) = (1-d) + d (PR(T1)/C(T1) + ... + PR(Tn)/C(Tn)) where:
PR(A) is the PageRank of page A,
PR(Ti) is the PageRank of pages Ti which link to page A,
C(Ti) is the number of outbound links on page Ti and
d is a damping factor which can be set between 0 and 1.
The original PR algorithm.

This scam has actually happened to me twice now so I am putting an end to people stealing link juice that can stay around for ages anymore by insisting that rel="nofollow" is put on all links UNTIL I get paid.

Once I get paid I remove the rel="nofollow" attribute and they get the benefits of the link juice they are paying for.

I usually change the posted date of the article as well so it looks like a new post to ensure BOTS will crawl and see the new links.

So beware.

This REL NOFOLLOW scam is real and I have fallen for it.


© 2014 Strictly-Software

Thursday, 20 February 2014

Quickly Generate A Random Number Between 1 and 9

Quickly Generate A Random Number Between 1 and 9

By Strictly-Software

As you should know by now the RAND() function in SQL has the downside that it will return the same value if the same seed is provided to it.

E.G if I call this code multiple times I get the same number for each result:

SELECT RAND(1) AS [RandomNumber]

This always returns 0.713591993212924 for me.

Therefore when people use RAND() they often end up coming up with various ways to generate a unique seed value as well.

One of the quickest ways I have found to return a random number is by using the NEWID() function which generates a random GUID.

If I wanted to return a random record from a recordset I would use the NEWID() function in my ORDER BY statement. 

I use this a lot in my Jobboard code when I want to return a random banner from a banner group like so:


SELECT TOP 1 BannerPK, BannerURL, RedirectURL
FROM   BANNERS
ORDER BY NEWID()


However if I wanted to return a single number between 1 and 9 I could use the following code.

This basically converts the GUID to a VARBINARY value before converting it to a VARCHAR and then taking off the the first character with a LEFT statement.

I have found that this gives a larger proportion of 1's than any other number but it is useful if you want a quick way in SQL to generate a single number (or more if you extend the numbers returned with a string function) e.g LEFT(val,2) or use a MID or RIGHT. Then this code could do the trick.


DECLARE @RANDNO INT
SELECT @RANDOMNO = CAST(LEFT(CAST(ABS(CAST(CAST(NEWID() AS VARBINARY) AS INT)) AS VARCHAR),1) AS INT)

Tuesday, 18 February 2014

A WordPress Performance Killer - Automatic OPTIMIZE or REPAIR on big Databases

A WordPress Performance Killer - Automatic OPTIMIZE or REPAIR on big Databases

By Strictly-Software

I used to use the WordPress plugin WP-DBManager. I still do for the automatic backups (when they work), I have found on one site the scheduling just doesn't work so I have to do it by hand. No difference between that site and another that works but hey that's WordPress!

However one thing I found, especially once I reached 20k+ articles is that my scheduled OPTIMIZE / REPAIR jobs would totally kill my sites every Friday for an hour or so.

It took me a while to find the cause but when I used the Server Monitor in Navicat and saw that both my Databases were doing a REPAIR by SORT at the same time, I soon realised it was my scheduled job in WP-DBManager to REPAIR / OPTMIZE every Friday that was the culprit.

With MyISAM tables (the default storage engine for WordPress), an OPTIMIZE or REPAIR job will take the whole table out of action as the process is carried out. The table is locked as the sorting and repairing is done which means no other users or processes can access it.

Unlike MS SQL which lets you De-Frag a tables index whilst connections to it carry on MyISAM just locks up until the job is complete.

Symptoms


  • Your website is hanging for ages, or timing out. If you are using Cloudflare you might be lucky enough to see cached pages either that a 503 service unavailable.
  • Running a TOP command will show MySQL process consuming 90-100% of your CPU.
  • Checking your Server Monitor in Navicat shows a SORT going on with a long execution time. The more pages and posts the longer it will take.


Risks


  • If you have an scheduled job to REPAIR / OPTIMIZE your tables, either through a plugin like WP-DBManager then you could suffer this problem.
  • The type and size of table matters. If it is using MyISAM it will be locked until the job is over. 
  • The bigger the table e.g WP-Posts the longer it will take. 
  • The more records the longer it will take. If the table is used a lot then it will be crushed until the job is over.


Solutions


  • I turned off the automatic OPTIMIZE and REPAIR jobs on WP-DBManager.
  • If I have scheduled downtime then I will make use of it whilst the werbserver is offline to carry out DB maintanance.
  • If you are clever enough (and I don't know if MySQL supports SYNONYMS like MS SQL) but you could create copies of your existing tables with new names, let your system carry on using the old tables whilst your OPTIMIZE / REPAIR the new ones. Once finished toggle the SYNONYM back to the newly formatted tables. A SYNONYM would be perfect for this but you could write SQL to create a table, insert records, repair and then re-name. Maybe a plugin could do this (ideas for developers? I would be willing to write one for ££)
  • I know use my own Strictly System Check plugin instead to handle automatic REPAIRS / OPTIMIZE as it will only carry them out if the system is already suffering. My plugin checks the server load, the time it took to load a page, the number of connections and so on. If the plugin determines that the system is having trouble you can set it to OPTIMIZE or REPAIR (after a check to see if one is needed). This way you are only fixing something that needs it rather than causing havoc for no need.


It is something to be on the lookout for. If your site suddenly acts slow with high MySQL CPU use then a scheduled REPAIR might be the cause.

If this happens it is best to turn off APACHE, let the REPAIR do it's job and then turn the webserver back on.


Thursday, 6 February 2014

Introducing a new version of Strictly AutoTags 2.9.1

Introducing a new version of Strictly AutoTags 2.9.1

As you should know by now I don't really like open source development.

When you have put literally hundreds of hours into a plugin such as I have with Strictly AutoTags it is a bit dismaying when you visit the Wordpress site and see that you have 180,000+ downloads (not millions but more than a few thousand), pretty good ratings, good reviews on SEO sites and other places Google returns from a search on the plugins name. Yet hardly anyone has bothered donating me any money. Just imagine if everyone of them had donated me a single £1 for my hard work?

Believe it or not it takes a lot of my spare time to keep a plugin like this maintained and working.

Having to keep it up to date with changes Wordpress make to their core code as well as adding new features that often involve complex regular expressions and logic to get right.

Is £1 a lot to ask from someone who finds a plugin such as Strictly AutoTags useful?

I mean I find it very useful on my own sites.

Not only does it automatically add relevant tags to news stories but it does so without having to rely on 3rd party API's that contain lookup databases of possible tags.

If a news story about me came out tomorrow and I was mentioned a few times in the article the plugin would pick my name up and add it to the sites list of tags without having to wait for someone else to decide I am important enough to be worthy of such a tag.

I have a couple of systems that automatically import news feeds into the site and then tweet out the contents to various Twitter accounts using another one of my plugins Strictly TweetBot.

It analyses the content of the article and can change the format of the tweet or the account it sends it to depending on what it finds. Having Strictly AutoTags sit in the middle of this process not only ensures I don't have to manually edit each article to find relevant tags but it also provides them to Strictly TweetBot be used as #HashTags when I tweet about the news story.

Also being able to set the plugin up to discover certain words and then tag the article with a totally different word is very useful for news based sites.

If I have a news story about Edward Snowden or the NSA Prism program I want to tag the article with the word "Privacy" or "Whistle-blower". The paid for version of the plugin allows such logic.

So because of the lack of enthusiastic donations I have split my code in two and kept a paid for only version of my plugin for those people who actually find tools like this useful.

I don't really like the idea of having to keep two lots of code up to date but if a £1 donation is too much from everyone of the 150,000 people who have used it then I have to sell the better version to get some sort of recompense. Otherwise I might as well stop putting the code online and just use it on my own sites.



Latest Features of 2.9.1 Include:


  • The ability to remove basic formatting from the post. Ideal for auto-bloggers who import from feeds containing , , , tags that could cause formatting issues on your site.
  • Better regular expressions, more checks and the ability to bulk re-tag and link with all key attributes (alt,title,src,href,data-blah) including shortcodes [youtube url] saved before re-formatting to keep the original HTML in tact.
  • New functions to find tricky words like al-Nusra Front, World War II or 2,000 Guineas.
  • Bulk update to remove all HTML the plugin adds.
  • Option to turn the plugin into Clean Edit Mode so you can edit individual articles to remove any HTML you don't like.
  • New functions to turn text like http://www.strictly-software.com and www.strictly-software.com into clickable links e.g strictly-software.com.
  • Set a minimum length of characters for a tag to be used.
  • Set the maximum number of words allowed in a tag.
  • Set equivalent words for tags e.g search for Edward Snowden, NSA or PRISM and use the tag Internet Privacy.
  • Bold and deeplink common used tags to create great SEO for Googlebot and BING to crawl.
  • Set the minimum number of tags that must be stored against articles before they can be used in any deep linking.
  • Set the maximum number of tags in an article to deeplink.
  • Set the maximum number of tags to place against an article.
  • Create a list of case sensitive and case insensitive "noise" words to ignore and never use as tags.
  • Use the new finished_doing_tagging hook which is available for other plugin authors to use so that actions only occur after tagging is done on a post. For example my other plugin Strictly Tweetbot uses this hook so that tags are available to be used as #hashtags in tweets.
  • All content already inside special HTML tags title, src, href, alt and new data-blah or data-blah-blah attributes and Wordpress shortcodes e.g [youtube url] are stored in memory to prevent bolding or deeplinking within other tags or attributes.







You can buy the latest edition of the plugin OR download the latest free version from my own webpage at www.strictly-software.com