Safari not liking the HTML5 Audio

 Well this one threw me for a loop….

 I never use Safari, but in an attempt to make my latest HTML5 Game compatible in all the major browsers I downloaded the PC version of Safari to do some testing and trouble shooting to see if it would work. The game worked well in Chrome, Firefox, and I.E. so I assumed it would just work in Safari. But no, to my surprise it started throwing the following error every time I tried playing one of the audio elements.

 TypeError: ‘undefined’ is not a function (evaluating ‘audioElement.play()’)

 After much frustration I came across a post which indicated that HTML5 audio and video tags will not work in Safari without QuickTime. So much for HTML5 not requiring any plug-ins. I installed QuickTime and to my dismay Safari was now giving me the following error when I tried to start it up.

This application has failed to start because QTCF.dll was not found. Re-installing the application may fix this problem.

After trying to reinstall the the browser (this did not work) I found the QTCF.dll file in the Program Files/QuickTime/QTsystem made a copy of it and put it in Windows/System32. This solve the problem and Safari now started up. I was able to load my game with no more errors playing the audio objects. Safari seemed to handle the canvas object fairly well (although the frame rate on seems to be fairly poor).

Source: http://happyworm.com

Source: http://answers.yahoo.com/question/index?qid=20090912133753AAM60Ur

Free Animated explosion on transparent background

While creating my first game I came across the need for some sprite sized explosion animations. I tried multiple times to draw them myself, however I just couldn’t get them to look right. So I turned to the web to see if I could find some royalty free explosion animations that I could use in my game. After a little searching I found several suitable sprite sheets like the one below on http://www.positech.co.uk/content/explosion/explosiongenerator.html (The website also features a free explosion generator program to make more).

The animation however was on a sprite sheet that had a solid background and I needed a transparent background. So, I took the time to cut them out using an alpha layer and then saved them to individual files. I have upload the cutout files as I figure it is likely others might find them useful. The below file includes a photoshop file with all the different frames of the explosion on different layers as well as all of the frames of the explosion separated into individual .png files with transparent backgrounds. These images are royalty free so please feel free to use them any way you like.

Download animation with transparent background

UPDATE: Couple more free animated explosions can be found here

explosion_animation_sheet

Include an “or” Operator in a JavaScript Switch Statement

I came across a situation where I needed a switch statement in JavaScript to do the exact same thing in multiple cases. For example:

switch (varAnimal)
{
   case ‘dog’:
   sameFunction();
   break;

   case ‘cat’:
   sameFunction();
   break;

   case ‘bird’:
   sameFunction();
   break;
}

While the above code works, if you have a long list of variables it is highly inefficient. To solve the problem I initially tried to use an “or” operator to try and test for the different values as you would do in an “if” statement. For example:

switch (varAnimal)
{
   case ‘dog’ || ‘cat’ || ‘bird’:
   sameFunction();
   break;
}

However this didn’t work. I found on a forum the below method which appears to accomplish what I was trying to do. It essentially lets you use an “or” operator to test for multiple cases which can save a lot of typing. For example:

switch (varAnimal)
{
   case ‘dog’: case ‘cat’: case ‘bird’:
   sameFunction();
   break;
}

Source: http://www.webdeveloper.com/forum/showthread.php?t=191879

7/11 Update

Well It has been one month now since I started this blog experiment and I really don’t have much to show for my efforts yet. This blog (infobrink.com) is as of yet the only source of income I am tracking and I made $0.00 last month (however I did end up attracting a zillion spam bots). This comes as no surprise to me as I have not yet placed any advertizing on the site (I am waiting for it to get a reasonable amount of traffic before I mess with that).

I have been spending a lot of time on my first HTML5 game I want to release and try to monetize. I am a little disappointed that this is taking me so long to finish it, but it is almost done. I think in my original concept for the game was too complicated/ambitious and was going to take me way to long to finish, so I ended up deciding to “simplify” the game so that it was easier/faster to write the code. I think this was a good move and I need to be more careful in the future and take into consideration how long it will take me to code a game when I am in the design phase.

All in all I would guess so far I have spent around 250 hours programing the game (I started the game long before I started this blog). I know a veteran programer could likely do the same thing in a fraction of the time, but hey…It was my first game and I had lots to learn. I just hope that all this time I have invested will actually convert into some extra cash…I guess we will see.

How to find the length of an associative array in JavaScript

So this little tidbit took me a bit by surprise. The .length property does not work on associative arrays in JavaScript. It will return zero no matter how many elements are in the array. Below is a script I found that will correctly return the length of a JavaScript associative array.

 

associativeArrayLength = function(obj)
{
    var size = 0, key;
    for (key in obj)
        {
        if (obj.hasOwnProperty(key)) size++;
        }
    return size;
};

 

Source: http://stackoverflow.com/questions/5223/length-of-javascript-associative-array

Select random element from a Javascript Array

Need to select a random element from a javascript array? The process is fairly straightforward but I was not clever enough to figure it out on my own. First take a random number with Math.random() [which will return a random number between 0 and 1] then multiply this number by the length of the array. You then need to use Math.floor to round the number down to the nearest whole number and voila… you have a random element number. All of this can be included in the square brackets of the array to make more condensed/easy to read code.

For Example

randomElement = testArray[Math.floor(Math.random()*testArray.length)];

 

 

Source: http://www.webmasterworld.com/forum91/2245.htm

How I Plan on Accomplishing My Goal

So, how exactly do I plan on accomplishing my goal of $1000/month in passive online income? That is an excellent question. In truth I am not exactly sure…I have only vague ideas and lots of ambition. I find it likely as time goes on my methods will evolve as I figure out what works and what doesn’t, but here is my current game plan. I plan on more or less following what I perceive the Google business model to be. Please forgive me if I am incorrect, but it seems like Google more or less operates by:

1. Creating awesome online services and apps.
2. Providing the services to the public for free.
3. Monetizing those services through advertising.

It appears to be working quite well for google (as well as countless other internet companies)…so why not me? It seems to me that internet culture more or less expects everything on the web to be free and most would prefer to view advertizements rather than pay for something (I know I would), so no wonder it works so well.

So first off I need to create something online that is useful and will attract visitors. I think the real trick here is to create something that is genuinely “useful” and not just “something”. Blogs are a way that many accomplish this (this blog is an attempt at exactly that). However I am quite passionate about games and want to try my hand at that as well. I am currently in the middle of developing a online HTML5 game. Hopefully the final product will be a game that is fun, appealing and will attract visitors.

Secondly I will provide the services I create for free (that’s pretty easy to do).

Lastly I will need to monetize the services/games/blogs. I still have a lot to learn in this area and I am guessing it might be a bit tricky to maximize the revenue of a site. I know there are countless services and techniques for this and plan on further investigating my options after I actually create something online that attracts a reasonable amount of traffic.

My thinking is that over time I can keep creating more and more online services/games/blogs until I make it to $1000/month. Sounds pretty simple right…guess I will find out.

 

Strange Indexing by Google

I know that it usually takes weeks/months to build traffic to a site but I put the blog on a old domain that still had a pagerank of 2. I am hoping by doing this it might help my rankings faster. The blog has been up for a little over a week now I figured that it is possible it might have seen some visits. Checking this was a simple matter as I had installed Google analytics the day I put up the blog to help track traffic (which I highly recommend to anyone). To my disappointment it doesn’t look like any real traffic besides me has been visiting the site (There were a handful of direct referrals from sites who linked to my old site, but I don’t consider these significant as the visitors were probably looking for something else).

 

So, if I have not yet received any traffic the site has probably not been re-indexed. To check this I did a quick search for “infobrink” on Google and I noticed something very strange. The first search engine result was the old version of my homepage (which was expected if the site had not yet been re-indexed), but right below it was one of my newer blog sub-pages that I had recently created. To me this seems awfully strange cause the only way Google could know about that sub page would be via crawling my homepage (I am fairly confident nobody has linked to my new subpages yet). If google was crawling my homepage and updated the index with my subpages why not update the index with the new homepage also? Hum..very strange…

Infobrink: Starting Out

I am not not necessarily starting from scratch on this one.  I have had the domain infobrink.com for several years now. Years ago I tried creating a online directory with the domain that promoted reciprocal linking, but abandoned the project long ago as unprofitable.  I continued to renew the domain over the years hoping that someday I might find a use for it.  Despite years of neglect the domain had still had a google page rank of 2 as well as lots of back-links.  Hopefully the extra links/pagerank will give the site a jump-start.

I decided to use wordpress for the blog, but I have only limited experience with it and have already I have run into a few hicups trying to customize the software and getting it to do what I want. I have never really blogged before either so that is new ground for me as well.

In the past I have tried to monetize various websites I created(including the old infobrink directory). However I never really realized and significant income through my efforts much less anything that was sustainable. In short, I have no experience with “successfully” monetizing a website.  I have read many blogs on bloggers monetizing their blogs so I assume it is very possible.  I plan on giving the blog a few weeks/months to see if it generates any significant traffic before spending the time effort to monitize the blog.

I started a few days ago on 5/27 and so far I have spent around 10 hours getting the site up and running and customizing the look.