When pulling comments from a database table, it can be very costly when you are performing a query that will automatically sort all of the comments into the parent child hierarchy. Every extra ms your SQL server spends performing calculations is time that is wasted. If you can easily move this logic to the programming language that you are using it will free up your DB server to serve more data. If you have a blog post that has comments, obtaining the comments from the DB for this post is a simple process, but the problem is that the order of the comments will not be right. If someone replies to the first comment days after lots of other comments have been made, this comment will show up at the end of the list returned from the DB. There are ways in which you can construct your query so that it will return an array of child comments for each comment, but this is way too wasteful. Using a simple recursive method you can sort out the comments using a programming language so as not to lock up your DB server any longer.

A simple SQL query like this is going to pull some comments from a database table that is storing comments for a blog post.

This query now leaves you with a list of comments that are a mix of parent and child comments are not in order. This seems a bit messy and can be a daunting problem to solve, but look at how simple that SQL query is. It is worth the effort when your DB server has very little to do to sort the comments. We are going to start this by creating the recursive function. A recursive function is a function that calls itself many times. The following function is written in PHP, but can be easily translated to any other programming languages.

This function accepts 2 parameters. The parent ID which is the Id of the comment that we want to get the child comments for, and then it contains the full list of all comments that were returned from the database query. When you want to see if a comment has children, you will loop through all of the comments checking to see if any of the comments have a parent ID that is equal to the current comment. Once we find a match we first need to check and make sure that this child comment doesn’t also have child comments,. This is why we use a recursive method. We cant tell how many comments have replies and how deep they go. This way we can do it without needing to know. Once we have checked for more child comments we can add this child comment to an array of child comments for the current comment we are checking.

The only thing left to do now is to determine how to set it off. We need a way to call this method and restart the recursive loop. Here is a completed method that will show you how to pull them from the database and then how to trigger the calling of the recursive loop.


Most people start blogging and get excited about the fact that you can actually make real money just from putting a few ads on your blog. This then leads to the main reason that ad-blocker and other ad blocking software has become so popular. When people to choose to monetize their blogs they seem to think that more ads means more money. This is true, but it is not now you monetize your blog efficiently and is exactly how you can trigger the downfall of your website. People do not want to visit your site and have to dig through layers of adverts in order to find the content they came for. Yes you may get a nice amount of money per visit, but over time the visits will slowly decrease until your site gets no visitors. Knowing how to effectively monetize a site with ads will save you a lot of heartache and is not as difficult as it seems. Sites like answers.com have become the most horrible websites on the web, you don’t want to become another site like this.

The first rule when running a site is never assume that your site is so good that people are going to flock from far and wide to view it. Unless you have a really particular talent or skill that is not something many people can do, chances are the content you post on your website can be found in several other places. In order to make your site work well, is to build a better user experience. If a user comes to your site and is plagued ad every corner with ads, the user will not enjoy their experience, and will likely avoid engaging with your site any further. A click from a search engine is like a fish biting a worm, you don’t want the fish to grab the worm and leave without biting the hook. You need to make the presentation as appealing as possible. If your site is better than other sites, you will get more traffic. More traffic means more ad impressions and more money for you. As always, never take advantage of the traffic by adding more ads. Make it look natural and never shove ads in visitors faces. More visitors will come if your site is good and this is how you get more ad impressions. Never sell out! Perseverance is the only way to make a successful website.

With everything that I have said above you are likely asking yourself, how many ads is too many and where should i place them. This is a very subjective question and there is no general answer that will cover all website, but here are a few things you should know to reduce the chance of making any mistakes.

Don’t bunch ads together

There is no point putting several ads all in the same location. Cluttered adverts look ugly, and usually cause the user not to look at this area of the page because they know its all ugly spam.

Don’t slow down page load speed

Adsense may be one of the most popular ad networks, but it is also one of the slowest. From experience i have seen each adsense advert add up to 1 second to the page load. Even when you use async ads, the page still is not considered loaded and it can make the users browser run very slow if they are not using a powerful device. Every ad you add to a page means more processing and more delay it takes to load the page.

Blend ads in with content 

Putting ads in obvious locations with big flashy banners is exactly what most people have trained their eyes to ignore. You need to merge your ads in with the content. Never put more than 1 ad in the body of an article. Putting it near the upper 3rd of an article is usually the best place to put your ads.

Consider Mobile

Sidebars are a popular and often effective location to place adverts, but these do not work for mobile sites. If you have a responsive site, chances are the sidebar gets moved to the very bottom of the page when viewed on mobile. If you have all your ads here or a large number of them on the sidebar, it will slow down the page and a large amount of visitors will never go down to this part of the page and never see these ads.

Users don’t need to see an ad on every page

When placing ads people often set it up in a way so that a user will see an advert on screen no matter what part of the website they are currently looking at. There is no need for this. A user is here to view your website, this is more valuable than the couple of cents you get from a user clicking the ad. Don’t make a user leave your site for a couple of cents. It can also make users dislike your site. They don’t want to feel like they are subject to a plague of adverts. Subtle advertising works far better than in your face. If a user visits one page and sees the same add 10 times all they will remember is that the website sucks. If they visit 10 pages and see the same add once, they will subconsciously remember the ad. This doesn’t benefit you, but it does benefit your long term income since you can guarantee effective advertising.

Don’t use popups for ads

If you want to use a popup for your newsletter then go ahead, but use a cookie to make sure it doesn’t keep popping up every time the user visits the site. Making ads pop up or even pop under are horrible intrusions to the user experience. They make you quick money and also make your site look bad. If you are running a viral site that has a 100% bounce rate then do what you wish, but if you want to run a proper website, don’t do this. It makes your site cheap and will push users away.

Alexa is a very popular source of tracking your websites popularity and traffic across the web. Its metrics are generated based on a few different factors, but for most people it will be based on a toolbar that the user has installed on their web browser. Website owners often put a lot of work into making sure their Alexa rank is as high as possible, but why? Does Alexa boost SEO?

Unfortunately there is no 100% guaranteed answer here. Google keeps its search engine ranking algorithm secret for a very good reason. If people know what Google checks, they will artificially inflate this statistic and unnaturally boost a website. When it comes to how Alexa affects search engine results, it is unlikely, but a good rank usually means your site is doing well and here’s why.

Traffic on your website is a good signal of a good website. If a site has 1 million daily visitors and another has 10 visitors, it is safe to assume that the site that is getting 1 million visitors, is better and more popular. Google monitors this kind of thing and will of course make the most popular site rank higher than the site that is less popular. Alexa rank will reflect this popularity, and is a great for you and other humans to see how popular your site is. Google is capable of tracking traffic on its own, so it is unlikely that it uses Alexa to influence its results, but that doesn’t mean you shouldn’t be wanting to get a good Alexa score for your website.

Humans are the ones that use Alexa. Marketing and advertisers will often check this site to see how popular your website actually is. If your site scores well, it will be seen as a valuable site and people will approach you to advertise their products on your website. This is almost as valuable as good SEO as it will give you a solid source of income for your website. So the question that might come from this is, how do you increase traffic to your website without SEO?

Getting traffic to your site can be difficult when you have a new website. You need traffic to get good SEO ranking, but its hard to get traffic when your site isn’t showing up in search engine results. It’s the catch 22 that ever website owner is going to deal with. Buying reliable traffic is a solution to this, but there are a lot of sources that send robots to your site which don’t help at all. There are many websites out there that offer traffic, one of which is Growtraffic. They offer affordable traffic that really boosts your websites online presence. For those who are looking to get a boost in traffic while you are working to increase your SEO and online presence, this can be a valuable source for you.

So to get back to the original question, does Alexa boost SEO? The answer is no, but it is a great way to check if your SEO efforts are working. A good Alexa rank will usually indicate good website SEO and performance.

Search Engine SEO

Getting the best possible performance out of your website is a difficult task to take on. There are so many things to do right and if you do them wrong, you will get no benefit at all. Google are not always clear about what factors affect the SEO performance of your website. One question that comes up a lot is “will SSL boost SEO for my website?” The short and simple answer to this is yes!

SSL is short for Secure Socket Layer and is a very simple way for you to add a layer of security to your website. Google have confirmed that they are going to start using this as a ranking factor for their search results. You can tell a site is using SSL when the URL bar for the website has a green padlock next to the URL. It is possible to have a site using SSL that does not get this padlock. If you do not have the padlock, then you will not get any SEO boost.



It is not currently known how much of a bonus google are going to give to sites that use SSL, but they have publicly confirmed that they do consider it. Over the next few years this will likely become a stronger factor for sites to use SSL to boost SEO.

Warning When Using SSL To Boost SEO

If you are using an adsense website your income is going to get hit pretty hard. Its currently a catch 22. Not all ad publishers are using https. This means that if your website is using HTTPS, you will not be able to display any of the ads that are not HTTPS. It would seem that quite a lot of these ads are not using HTTPS, which means using SSL to Boost SEO, is a good way to boost your SEO, but it will hurt your adsense income.

apache subversion

When using SVN via command line you can view the details of previous revisions by viewing the SVN log. Call the log along with the number of revisions you want to have returned to you will display the message left when the file was committed, number of lines changed, user, date and a few other details. Ideally you would have access to a GUI tool such as tortoise SVN which will give you a much more feature rich log along with the ability to compare current revisions with past revisions.

In order for this to work you need to be in the directory of an SVN checkout. If you do this in a directory that is not a SVN folder you will get an error message due to an unrecognized directory.

If you want to display everything within a specific date range you can use the following

If you want to list everything (may not be all that good of an idea if you have a huge amount of revisions).

Ascending Order

Descending Order