Boolean and 0.00

ARG. I encountered another potential issue in PHP that is due to loose types that is common if you are using a database back end.

$amount = 0.00;


$amount = ‘0.00’; // how data from databases comes

Guess what happens. Well, most people might say both should be TRUE, but that’s not true!

The first one evaluates like this:

  1. 0.00 is the same as 0
  2. 0 is the same as FALSE.
  3. Evaluate the IF condition as FALSE.

The second one evaluates like this:

  1. “0.00” is a string.
  2. A non-empty string is the same as TRUE
  3. Evaluate the IF condition as TRUE.

This is a predictable problem, but highly annoying when working with databases. Most people forget that a float field in the database could equal 0.00, but would evaluate as a TRUE when placed in a condition.

As in, when you get results from the database, the NUMBER 0.00 becomes the WORD “0.00”.

So the lesson here is to make sure you always convert your variables before doing conversions like that. As in:

$amount = ‘0.00’;

Of course, the best solution is always making comparisons explicit:

$amount = ‘0.00’;
if(0 < floatval($amount))

The Internet Commons Tax Deduction – Why We Need It

Today, I was visiting, trying to figure out how the site makes money. I noticed some Yahoo ads. So what happens if they run out of donations? Do people donate? TinyURL is just an example. There are definitely other sites that do give free services with nothing but donations in return.

How many websites get ad spammed or simply close down because the owner can no longer afford to host the material for free? This is when it hit me. Free Internet services needs a tax break.

It would need to encourage giving and have a benefit ceiling to ensure only people that need the protection get it. Here’s an example of how the Internet Commons Tax Deduction could work:

  1. A site owner receives a tax deductible credit up to the same amount as all donations received that year.
  2. The total tax deduction granted can never exceed the hosting costs. **

In other words, this acts as a tax deductible item for the owner, making it beneficial for people that have popular hobby projects running off of their personal bandwidth. And, of course, it only kicks in so long as you’re running at a loss. And, it encourages and amplifies giving. It will never counter the losses 100%, but it certainly softens their effect.

The Internet is where it is today thanks largely to much of it being free. While the cost of bandwidth is ever decreasing, it is still expensive to run a popular site. This means that as a person’s contribution to the net grows, their costs due to bandwidth also grows (see orange chart).

There are plenty of very important websites that contain information to help consumers that are entirely non-profit. Even the non-profit Wikipedia had to start somewhere. Then there’s the websites that merely provide value to the web as entertainment. Finally, there are open source projects. These sites have to deal with all the same costs that for-profit websites do, in some cases their costs are even greater.

The current model requires begging for donations while letting companies (leeches) like Paypal take a percentage. Or slapping on a thousand ads. Okay, we can deal with Paypal, and maybe the ads, but what happens if donations and ads don’t cut it? Should a site be subject to destruction simply because its owner can’t afford to spawn a company around it? Can’t the owner get a break for providing stuff for free to the entire world?

No, the person supplying the free goods gets shafted.

Once, long ago, I wrote a dating site engine. For fun. It was my second major project in PHP that I did as a learning experience. After I completed it, I just left it up for anybody to sign up. Did I have intentions of monetizing it? Not in the slightest. The only reason it is still up today is because I could afford the bandwidth costs, but not everybody could have.

Or last year, I wrote a AIM profile tracking service for fun. That too is also sitting around without being monetized. And hopefully, I’ll never have to take it down due to financial short comings.

There are so many cool little projects that turn into amazing things on the net. Many of them become companies, but this is because, currently, monetizing a particular idea is the best and only way to keep it alive. This is also why many companies die on the net – some ideas just can’t float an entire company. Those are the ideas I am targeting here.

Is this essentially a small business tax break? That’s not the direct intention, but it certainly could have that consequence if the revenue cap is set too high. But it also helps many others:

  • The government – a lot more concept websites will mature from infancy into profitability (tax generating businesses) without dying a premature death.
  • Average Joe – even more free web services will pop up, many of which may have never seen the light of day otherwise.
  • Open source – this will help many of the smaller open source projects afford their hosting costs as well as encourage even more donations.
  • Code junkies like myself – it gives us a true financial incentive to share (and host) our work with the world.

My real point here is that hosting stuff on the web is not free. It costs somebody, somewhere, a ton of money. The little guy, who often is the innovator on the Internet, is the one who gets screwed when too many people take his/her work for granted. It’d be nice if those innovators got a little break from Uncle Sam.

Hey, I can dream, can’t I?

**Here is some hypothetical fine print that would probably need to exist (for you nitpickers):

  • There is a annual cap of $XXXX that can be credited in this way. The credit given plus donations reported must be less than the annual revenue generated from the site.
  • Limit of 2 sites are eligible for this deduction per person/company.
  • If revenue generated (including donations) from the site exceeds twice the annual cap ($XXXX), this tax deduction no longer applies.

Google Groups Out of Beta – Google’s Commitment to Integration

Here’s some interesting Google news that hasn’t really been covered anywhere yet (except in Google’s blog): Google Groups is now out of Beta. I’ve never understood how a particular product gets out of “beta”, but I’ll take extra features with a smile. From the post:

Now you can customize the look of your group, create and edit web pages, upload and share files (including photos), and view member profiles. And for your discussions, there’s no need to struggle to follow interrupted conversations, as Google Groups now includes the same style of organization that Gmail users love.

This reminded me of something Sergey Brin said a few months ago:

What we are concerned about is that if we continue to develop so many new individual products that are all their assorted silos, you will have to essentially search for our products before you can even use them… There’s a whole set of initiatives that’s now going on in the Company to make our product offerings simpler and more consistent for all of our users.

The newest features in Groups shows this commitment. From the tour, I pulled two images. One shows an interface that looks and acts just like Gmail.

It even has Adsense on the right side!

Another image shows something that is strikingly similar to Google’s Page Creator.

Google has taken their groups concept and given it a turbo boost.

Simply looking at these two examples of technology integration, we should expect an event organizer in the near future that syncs with your Google Calendar as well as Web Album integration for publishing photos. One of the most obvious integration with Google Maps is missing, and I hope we can see that in the near future. There are many, many ways they can do this as demonstrated by the web-soup of Gmaps mashups out there. Most particularly, member and event locations comes to mind. Lastly, I’d love to see further integration of Gchat, much in the same way as they have done in Gmail. Being able to do group chatting on the web would be cool. Well, realistically, Gchat should work anywhere on so long as you are logged in…

Someday, I’ll use Groups to organize my poker games, but until I see integration with Google Calendar, I think I’ll continue using mailing lists. Having a centralized way to group up a recurring event is exactly what Calendar needs, while a way to better coordinate “when and where” is what Groups needs. Let’s cross our fingers and hope somebody is listening.