February 15, 2009

Selling Flash Files, Icons, Scripts and other web content

To start the new year, we have officially launched OOF Media as a marketplace for buyers and sellers of all kinds of digital media.

We created OOF with a few simple goals in mind:

  1. Creating an attractive, interactive & professional website should be simple.
  2. Searching for media should be fun, not depressing and mind-numbing.
  3. Stock media should be affordable.  You shouldn't need to get a loan to buy a web template.
  4. Media authors should be compensated quickly for their hard work.
  5. Authors should be able to sell flash files, sell icons, sell code scripts, sell web templates, and sell domesticated jungle animals.
  6. Authors do the heavy lifting and should be compenstated appropriately.
  7. Buyers should not be forced to deposit $20 into an account, just to purchase a $2 product.
  8. A marketplace that does not adhere to the above principals should be shut down and fed to a llama.

We demand that you bookmark our site. With our rediculously good seller incentives, we'll have great new products available for you on a regular basis.

Also, feel free to contact us for any reason at all, including:

  • To ask a question
  • To brag about how great you are
  • To provide negataive or positive feedback
  • To tell us what you ate for breakfast

Thanks for OOFing!
February 21, 2008

Plone Blog Products

Just wanted to share an experience with you. Two nights ago, I couldn’t access the ZMI on my server. The ZODB had been filling up at an exponential rate for 12 hours. This caused the server to slow to a near halt and also corrupted the ZODB a little bit.

The culprit – blog comments. I had installed CoreBlog2 for a client and a week later, a spambot got to it and hit it hard with thousands of comments / hour. As we know, each comment is an object with metadata, etc., so they are not lightweight objects. Lesson learned – do not allow comments on blog products, or at least protect yourself with some sort of CAPTCHA or log in for commenting.
November 7, 2007

Don't forget about Web Services

In a recent web app, I needed to determine whether a domain name provided by the user is available or has already been registered. I first decided to research Web Services! They're out there, many of them are free, and they are easy to use.

Implemented as a Remote Procedure Call (RPC), you connect with these services through HTTP using a protocol such as SOAP.

Call a web service method by using your scripting languages HTTP libraries or methods. When making calls, method arguments can be provided in the query string. Here is an example in pseudo code:

result = context.httpCall(server='www.webservicex.net',page='/whois.asmx/GetWhoIS?hostname=' + domain)

The example above makes a call to a whois server, using a popular and free web service network, webservicex.

The result will be formatted as XML, generally using the SOAP protocol. Now, every developer in the world will frown on me for saying this, but it must be said! Why bother learning SOAP or XML! Just parse out the value that is useful to you from the response.

For example, the return XML above is just a long string in your scripting languages eyes. Do some simple string parsing as follows:

if result.find('No match') > 0:
    return True
else:
    return False
August 23, 2007

CSS and Browser Compatibility

We've all spent sleepless nights trying to get a website to look identical in Firefox as it does in Internet Explorer. Now with Safari and IE 7 on the rise, we have even more compatibility nightmares to contend with. Let me share a few tips that might make things a little easier for you.

First, design the HTML and CSS for Firefox and test the everything looks the way it should.

The next step is to create an alternate stylesheet for Internet Explorer, call it IEFix.css.

Now, between your <head> tags, place the following code snippet:

<!--[if IE]>
  <style type="text/css" media="all">@import url(http://www.mysite.com/IEFix.css);</style>
<![endif]-->

This code will be executed only within Internet Explorer browsers. Now you can modify IEFix.css to make any corrections that might be necessary for IE. Test your site in IE and make sure everything looks ok.

To take this one step further, now apply that same concept to Internet Explorer 7 to really fine tune your website's compatibility:

<!--[if IE 7]>
  <style type="text/css" media="all">@import url(http://www.mysite.com/IE7Fix.css);</style>
<![endif]-->

Create another CSS file called IE7Fix.css and modify it until your site is fully "browser-compatibized"!

August 22, 2007

Use appropriate data types in your database tables

Just this past week I was called upon to troubleshoot some code executed various sql queries on a database. Though not important for the task at hand, I couldn't help but notice how little care was taken in modeling the database tables. Almost every column, whether it be a number, date, or text, was given a data type of either text or varchar (100).

Let's take a look at what you lose when you don't assign the proper data type to a column:

  • Date / Time formatting, comparison and arithmetic functions provided by the DBMS.
  • Storage optimization provided by numeric fields.
  • The ability for other applications to make sense of your data.
  • The value of optimizations such as indexes.

And let's not forget what you gain by using correct data types:

  • Data integrity constraints.
  • Validity checks for proper data type on data inserted or updated.
  • More optimized querying.
  • Data compatibility with the scripting / programming language you are connecting with.

When using VARCHAR or CHAR data types, try to think like a computer when deciding the length of the field. While we like to think in 10's, computer's, as you know, like binary. So instead of a VARCHAR(30), try a VARCHAR(32).

August 20, 2007

Use CSS to reduce server load

A couple weeks ago I talked about reducing server load by using JavaScript. Let's take a look at another technology, CSS, that can also help reduce server cycles otherwise used for presentation or style.

I'll introduce one example to show the power of CSS and will leave it up to you to further research the full capabilities of the CSS specification.

Assume that we want to display a list of links with initial capitalization, that is, the first letter of each word is uppercase. With PHP, we might be inclined to write a function and call it each time a link needs to be 'initial capped':

<ul>
  <li><a href="http://www.example.com"></a></li>
  <li><a href="http://www.example2.com"></a></li>
...
</ul>

<?

function initCaps($text) {

  $tok = strtok($text, "_");
  $phrase = '';
  while ($tok !== false) {
    $word = strtoupper(substr($tok, 0, 1)) . substr($tok, 1);
    $phrase = $phrase . $word . ' ';
    $tok = strtok('_');
  }

  return $phrase;

}
?>

In the case above, your web server is working overtime to execute thousands of lines of code just to capitalize each word in a link for any number of users currently visiting the website. Meanwhile, the client's PC is only required to parse and display one web page.

Let's give that client just a little more work to do. I introduce the CSS text-transform property:

ul li a { text-transform: capitalize; }

It's that simple. CSS can do a lot more for you in the way of presentation. Make your web server happy and skim through the CSS specification.

August 16, 2007

I removed a page from my website, but it's still in Google's index

If you've ever used Google's Webmaster Tools, you might have come across a few error messages indicating that a page could not be found on your website. Usually the case is that a page existed on your site when it was indexed by Google, but that page has since been deleted.

If you like to completely remove pages after their usefulness has diminished, it makes sense to notify search engines that your are doing so.

Google gives us a method of doing so in the form of a META tag. Use the example below on any page you wish to be removed from Google's index after a certain date.

<meta name="GOOGLEBOT" content="unavailable_after: 01-Jan-2008 16:00:00 EST">
August 15, 2007

Preventing spam on your blog

I'm fairly new to the blogging world, as you can see by looking at my oldest post. I've already run into spam issues that cause hundreds of spam comments per day to be posted to my articles.

My first course of action was to install a CAPTCHA plugin. This particular plugin works for my blogging system, which is bBlog. It can be downloaded at http://www.handgestrickt.biz/bblog/files/File/Downloads/bblog_captcha_0_2.zip.

So I installed the CAPTCHA plugin, only to find that my comment SPAM has only been reduced by about 10%. After analyzing the comments, I discovered that 99% of them were small messages such as 'nice post' or 'great blog' or contained nothing but a link to another website.

With these findings, I decided simply to filter out all comments less than 50 characters in length as well as comments containing links. The PHP equivalent of this filter is:

if ((strpos($comment, '<a') === false) && strlen($comment) > 50)

If you are using bBlog, you can insert this conditional in the bBlog.class.php script as follows:

if ((strpos($comment, '<a') === false) && strlen($comment) > 50)
{
  $q = "insert into ".T_COMMENTS."
    set $parentidq
    postid='$postid',
    title='$title',
    posttime='$now',
    postername='$postername',
    posteremail='$posteremail',
    posterwebsite='$posterwebsite',
    posternotify='$notify',
    pubemail='$pubemail',
    pubwebsite='$pubwebsite',
    ip='$remaddr',
    commenttext='$comment',
    onhold='$onhold',
    type='comment'";
  $this->query($q);
  $insid = $this->insert_id;
}
if($insid < 1) {
  $this->standalone_message("Error", "Error inserting comment: Comment may be too short or contain links. This is a spam prevention mechanism.");
August 14, 2007

PHP text field length issues with ODBC connections

This is one that you'll definitely want to archive as a reference because you're bound to run into this issue sooner or later if you ever need to develop a database-driven site on PHP/Windows.

I was recently contracted to troubleshoot a website migration to a Windows / IIS / PHP server. The migration was smooth but most of the website content appeared truncated, as if the web browser just didn't want to display more than 2 pages worth of information.

It ends up that the MySQL ODBC driver was truncating text fields at 4096 bytes when queried. A little research told me that this is a php.ini configuration issue where the maximum size of a return field is set at 4096 bytes. The php.ini directive I'm speaking of is odbc.defaultlrl. I call it a configuration issue simply because the default value of 4096 bytes is ridiculous and is bound to cause headaches for most webmasters.

Set odbc.defaultlrl to a higher power of 2 to maintain your sanity. I like odbc.defaultlrl = 32768.

August 10, 2007

Blogs and Search Engine Optimization

It's a well known fact that search engines love blogs. They thrive on the consistently updated content. But is it enough to simply offer loads of content? Remember that search engines need to parse your pages to separate HTML tags from actual content. It therefore makes sense to be sure that your content is marked up properly to make it search engine friendly.

If you are using hosted blog service, there isn't much you can do to modify the HTML to make it more search engine friendly. I recommend hosting your own blog and choosing a popular open-source blogging platform to install on your server. I personally use bBlog, but had to modify the code a little bit to make sure the proper HTML tags were being used.

For example, the first thing I noticed was that page titles were simply wrapped in a div or h2 tag. This does nothing to emphasize to search engines that this is the title of the page. Page titles should be wrapped in h1 tags. Also be sure that the page title is reflected in the title meta tag in the HTML header.

The second improper tag use I discovered was the use of the h2 or h3 tag to wrap the date of the blog entry. While the date is important, it hardly can be considered a subtitle of the article, which is what the h2 and h3 tags should be used for.

Make sure to modify your blog software to make it as SEO friendly as your knowledge of SEO allows.