Calculating Average Rating the Right Way using PHP and MySQL

These days ratings are everywhere, especially with the increasing popularity of Rich Snippets and with Google encoraging webmasters to implement them on their websites. You've surely seen search results looking like this:

Google Search Result

Google Search displays these fancy 5-star ratings thanks to the Aggregate Reviews snippet (consider checking it out if you haven't already done so). To make this rich snippet work, you feed it with an average rating (grading scale is from 1 to 5, 1 being the worst, 5 being the best) and optionally - with the total number of votes that formed this average.

read more

How Cloud Hosting Works (A Brief Technical Overview for Beginners)

Cloud Hosting was originally introduced to the public at around 2008 and has been enjoying an increasing popularity ever since, with more and more web businesses switching to cloud hosting solutions to run their websites on. Cloud Hosting has been described as the more effective, cheaper and much more reliable alternative to Traditional Hosting and that is true for the most part. Indeed - cloud hosting makes sense, but only assuming we have larger businesses in mind, which have to serve millions of users on a weekly basis. For smaller companies, the traditional dedicated server model may still be the better and cheaper option.

But we are here to talk about cloud hosting. Now, when you read on the Internet, everybody keeps pointing out the benefits of cloud hosting, but when you actually get your cloud hosting account, you realize that none of these articles explained in detail how you are supposed to set up your hosting environment afterwards, and all of a sudden hundreds of unanswered technical question arise that you have no idea how to deal with. Well, I will try to answer these in the present article.

Let's imagine you are the owner of a site called YOURSITE.COM and want to configure your cloud hosting environment accordingly, so the site can operate from there.

read more

How to Embed Webfonts Properly and How to Solve the Ambiguous "CSS3111: @font-face encountered unknown error"

F12 Developer Tools

In the present article, we will be discussing how to embed webfonts properly with good cross-browser support, focusing especially on Internet Explorer, which is known to be one of the most troublesome browsers when it comes to @font-face declarations. We will also clarify the meaning of the ambiguous CSS3111 error caused by certain webfonts in IE. Let's start, shall we?

Getting a @font-face declaration to work properly in every browser can sometimes be a really challenging task for a web developer, especially when it comes to older versions of Internet Explorer. Although IE9 offers a relatively good font embedding support, browser statistics show that even in the beginning in 2012 a little over 10% of the web users still use IE8 (which is actually more than the people currently using IE9) and almost 3% use IE7. There are even people still on IE6! These may sound like small numbers, but when you sum them up, you'll realize almost 15% of your users are using old versions of Internet Explorer and if you're the owner of a high traffic website with, say, 5 million unique visitors per month, that's 750,000 people!! Imagine the profits you may be missing, just because of a faulty embedded font ruining the look of your website in their old browsers. It's just terrible!

read more

Universal Web Scraper version 1.0 released!

Universal Web Scraper

Universal Web Scraper is, as its name says, a universal web scraper and web crawler written in PHP and meant to be used primarily for data extraction tasks along with a tool like Firebug for example that allows you to view the source code of webpages. I developed it for my own data extraction needs and used it for web scraping numerous times, but in my efforts to improve it and make it even more flexible, I figured out it may be a good idea to share it with the rest of the world, so I can get some feedback and constructive criticism.

There are many web scrapers out there, but most of them:

read more

ActionScript 3: Sound.extract() Demystified or How to Draw a Waveform in Flash

I was working on a Flash project recently and had to draw the waveforms of certain files that were included in the project. To my surprise, there wasn't much information on the Internet on how to achieve that in Flash.

There were indeed a couple of nice articles on the topic that I was able to locate: Rendering spectrums with Sound.extract() & Plotting a Sound Wave in Flash AS3, and although the code examples were really good, I realized from a beginner point of view they were a bit hard to understand. I also felt some key concepts that a beginner needs to know about how sound data is stored, how byte arrays work, what does Sound.extract() do exactly etc. were missing from these articles.

On the other hand, the official Adobe Documentation concerning the same topic was also lacking detailed information on certain aspects of the Sound & ByteArray classes that one needs to know in order to understand these classes fully, so that's what made me write this article.

read more