Monday, February 26, 2007

Web 3.0 = (4C + P + VS)

Written by Sramana Mitra
I have written a few pieces already addressing the disjointed nature of the web, whereby, you go one place for content, another for community, and a third for commerce, the most notable of these is the popular, 4C: Yahoo’s Turnaround Formula.

Let’s quickly recap the terminology:

3C = Content, Commerce, Community | 4th C = Context | P = Personalization | VS = Vertical Search

This, I submit, is the formula for the future: Web 3.0 = (4C + P + VS).

Web 2.0 has been a nichy phenomenon with hundred and thousands of microcap efforts addressing one of the Cs, lately, Community being the most popular force, producing companies like MySpace, Facebook, Piczo, Xanga, and Flixster.

In Web 1.0, Commerce had been the driving force, that produced companies like Netflix, BlueNile, Amazon, and eBAY. It had also resulted in the Dotcom meltdown.

The same period that is seeing the surge of Web 2.0, has also seen a great deal of investment in Vertical Search, like Sidestep for Travel.

Personalization has remained limited to some unsatisfactory efforts by the MyYahoo team, their primary disadvantage being the lack of a starting Context. More recently, Netvibes has raised a lot of buzz, but also lacks the same organizing principle: Context.

In Web 3.0, I predict, we are going to start seeing roll-ups. We will see a trunk that emerges from the Context, be it film (Netflix), music (iTunes), cooking / food, working women, single parents, … and assembles the Web 3.0 formula that addresses the whole set of needs of a consumer in that Context.

- I am a petite woman, dark skinned, dark haired, brown eyed. I have a distinct personal style, and only certain designers resonate with it (Context).
- I want my personal SAKS Fifth Avenue which carries clothes by those designers, in my size (Commerce).
- I want my personal Vogue, which covers articles about that Style, those Designers, and other emerging ones like them (Content).
- I want to exchange notes with others of my size-shape-style-psychographic and discover what else looks good. I also want the recommendation system tell me what they’re buying (Community).
- There’s also some basic principles of what looks good based on skin tone, body shape, hair color, eye color … I want the search engine to be able to filter and match based on an algorithm that builds in this knowledge base (Personalization, Vertical Search).

Now, imagine the same for a short, fat man, who doesn’t really have a sense of what to wear. And he doesn’t have a wife or a girl-friend. Before Web 3.0, he could go to the personal shopper at Nordstrom.

With Web 3.0, the internet will be his Personal Shopper.

Wednesday, February 21, 2007

10 things you (probably) didn’t know about PHP.

Here’s a short list of cool features that might have slipped under your radar as well:

1. Use ip2long() and long2ip() to store IP addresses as integers instead of strings in a database. This will reduce the storage space by almost a factor of four (15 bytes for char(15) vs. 4 bytes for the integer), make it easier to calculate whether a certain address falls within a range, and speed-up searches and sorts (sometimes by quite a bit).
2. Partially validate email addresses by checking that the domain name exists with checkdnsrr(). This built-in function checks to ensure that a specified domain name resolves to an IP address. A simple user-defined function that builds on checkdnsrr() to partially valid email addresses can be found in the user comments section in the PHP docs. This is handy for catching those occasional folks who think their email address is ‘’ instead of ‘’.
3. If you’re using PHP 5 with MySQL 4.1 or above, consider ditching the mysql_* functions for the improved mysqli_* functions. One nice feature is that you can use prepared statements, which may speed up queries if you maintain a database-intensive website. Some benchmarks.
4. Learn to love the ternary operator.
5. If you get the feeling that you might be reinventing the wheel during a project, check PEAR before you write another line. PEAR is a great resource that many PHP developers are aware of, yet many more are not. It’s an online repository containing over 400 reusable snippets that can be dropped right into your PHP application. Unless your project is trully unique, you ought to be able to find a PEAR package that saves at least a little time. (Also see PECL)
6. Automatically print a nicely formatted copy of a page’s source code with highlight_file().This function is handy for when you need to ask for some assistance with a script in a messageboard, IRC, etc. Obviously, some care must be taken not to accidently show your source when it contains DB connection information, passwords, etc.
7. Prevent potentially sensitive error messages from being shown to users with the error_reporting(0) function. Ideally error reporting should be completely disabled on a production server from within php.ini. However if you’re on a shared webhost and you aren’t given your own php.ini, then your best bet is to add error_reporting(0); as the first line in each of your scripts (or use it with require_once().) This will prevent potentially sensitive SQL queries and path names from being displayed if things go awry.
8. Use gzcompress() and gzuncompress() to transparently compress/decompress large strings before storing them in a database. These built-in functions use the gzip algorithm and can compress plaintext up to 90%. I use these functions almost everytime I read/write to a BLOB field within PHP. The only exception is when I need full text indexing capabilities.
9. Return multiple values from a function with “by reference” parameters. Like the ternary operator, most PHP developers who come from a more formalized programming background already know this one. However, those who’s background is more HTML than Pascal, probably have wondered at one time “how do I get multiple values back from a function I wrote, even though I can only use one return value?” The answer is that you precede a variable with “&” and use it “by reference” instead of “by value”.
10. Fully understand “magic quotes” and the dangers of SQL injection. I’m hoping that most developers reading this are already familiar with SQL injection. However, I list it here because it’s absolutely critical to understand. If you’ve never heard the term before, spend the entire rest of the day googling and reading.

Monday, February 19, 2007

10 Mistakes that Will KILL a Forum

1. Unless you're trying to become the next Million Dollar Hompage, a ton of ads just wont work for your site.Excessive Ads - Hey, there’s nothing wrong with making some money off your forum. But, when your advertisements begin to take up more space on your forum than your content, you’ve got a problem. People visit forums to talk to other people with similar interests. They want to share their ideas or ask questions. They DON’T want to have to sort through 3 pages of ads, to find one page worth of content. Think of it this way, you don’t tune in to your favorite TV show to watch the commercials do you? Well neither do your visitors.

2. Cliques - OK look, your forum is supposed to be an online community, not an online clique. If your community is not open and welcoming to new members and fresh ideas, your forum will quickly stop growing, become stagnant, and eventually die out. People want to be accepted. It’s perfectly fine to have a group of friends in your forum, just be sure you don’t isolate yourself from the rest of the web.

3. Trolls - never a good thing for a forumTrolls - Everyone’s encountered a troll whether you knew it or not. The Urban Dictionary defines a troll as “someone who gets pleasure by typing annoying/controversial/offensive words on internet forums or message boards.” If you run a forum long enough, probably every one of your members will annoy you from time to time. That’s just human nature. Trolls on the other hand, bring absolutely NO value to the forum and instead sit back and generally annoy you along with everyone else on the forum. They simply aren’t worth the hassle. To top it all of, many times, not only are trolls an annoyance, but they end up starting…

4. Fights - Now don’t think for one second that everyone on your forum will agree with each other all the time. It’s just not going to happen. In fact, you don’t even WANT it to happen. Controversy is good remember? However, there’s a BIG difference between a healthy debate/heated discussion and a fight. Once a discussion or debate devolves into name calling and personal attacks, it’s time to shut it down. If you let fights fester, they’ll begin infecting the rest of the forum and will likely end up driving away people on one, or both sides of the issue. You’ll also lose members who simply don’t want to hear the pissing and moaning anymore. The internet is a vast and wonderful place, if your site loses its appeal, your members can abandon ship and jump over to an alternative with just a few quick keystrokes.

5. You need moderators that are Kung-Fu MastersHeavy Handed Moderating - Have you ever heard the saying that “absolute power corrupts absolutely”? Or maybe, “the power’s gone to his head”? Both of these things can befall you, or your moderators if you don’t watch out for it. Forum Moderators or Administrators are given power to keep the rest of the forum in line. But, as Uncle Ben told Spiderman, with great power comes great responsibility. To continue the string of cliches, Moderators/Admin’s need to tread lightly but carry a big stick (basically they need to be Kung-Fu Masters). All forums and communities need a chain of command, but given the right situation, one Mod on an ego trip can splinter your forum while you’re on your lunch break.Don’t get me wrong, spam needs to be deleted, fight threads need to be locked, and the rules need to be enforced. However, you and your mods must always remember that your forum exists due to the contributions of your members. Arbitrarily closing threads critical of you or the forum can be dangerous and secretly deleting posts is just asking for trouble. If you’re involved in the argument, ask another moderator to step in. Take a breather, calm down, and make sure none of your decisions are motivated by anger or selfish ambitions. If you’re unsure which course of action to take, ask the rest of your staff. Whatever you do, always be open about it. When you screw up, and you will, man up and admit it.

6. Lack of Moderation - Yes, I just got done telling you that Over Moderation will kill your forum. The truth is, so will a lack of moderation. If you find yourself spending hours a day just trying to control your forum spam, it’s time to find some Mods. Get friends or family to help out or promote some trusted and long time members. And most importantly, use them. Consult them, give them a heads up before implementing changes, and listen to them when they offer up suggestions. You may even want to create a private “Moderators only” section where you can discuss any issues that pop up. But whatever you do, make sure you give your members a nice place to come. You wouldn’t invite friends over to your house if it looked like some back alley. The same holds true to your forum.

7. Don't over post. You'll smother your forum.Over Posting - Look, people don’t come to a forum to hear one person talk all the time. It’s a community, not a soap box. If you want it to be all about you, start a blog. It’s very easy to dominate a forum, especially in the early days. There’s not a lot of activity and you’re eager to keep the conversations going. But, you need to give others a chance to answer questions, give advice, or offer up their opinions. If a post goes ignored for too long, by all means reply, but you’ll smother your forum if you’re the first to reply to every single post. As the old saying goes, “Better everyone think you a fool, than to open your mouth and prove them right.” And who knows, you might even learn something…

8. Violating Privacy - This one’s a no-brainer. When people sign up for your forum, they almost always have to give you some information. Whether that’s an email address or some other bit of privileged information, don’t compromise it. Don’t sell your email list or start spamming your members with your latest chain letters. Trust me, they won’t appreciate it. See, I told you this one was simple.

9. Your site visitors aren't turtles... they want Speed!Slow Site - You remember how slow dial-up internet access used to be? It sucked right? Especially if you’d ever used a high speed connection. Well, having too many ads (yes, it’s worth mentioning again), widgets, plugins, or those cool ad-ons included in your forum can drag your site back to the dark ages. Navigating around a forum requires more clicks than on an average site, and members spend a longer than average time on your site. If every one of those clicks takes your users to a page that is slow to load, it’s going to take a LOT longer than it should to get around the site. We’re now firmly entrenched in an age of instant gratification and if your site is slow to load, your members and visitors simply won’t put up with it. They have too many other sites out there to sit around and wait for yours to get it’s act together.

10. Actually… there is no #10 - Oh wait! Over promising and under delivering. This is pretty much a good rule for life in general but it definitely applies to forums. If you tell your members you’re going to do something (add a feature, take care of a problem, listen to suggestions) then you’d better do it. Be very careful in what you promise and remember, this is a forum so everything is in print. You’d be surprised what people remember and call you on later. A couple of slip ups will likely be forgiven (they have in our case) but if you make a habit of getting people’s hopes up, only to disappoint them, don’t be surprised if you have fewer and fewer people to cry wolf to next time.