Archive for June, 2011

How to find the length of an associative array in JavaScript

Posted in Programing, Web Development on June 26th, 2011 by Jarred – Comments Off on 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;



Select random element from a Javascript Array

Posted in Programing, Web Development on June 25th, 2011 by Jarred – Comments Off on 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)];




How to test if a Javascript Array Is empty

Posted in All, Programing, Web Development on June 25th, 2011 by Jarred – Comments Off on How to test if a Javascript Array Is empty

Need to test if a javascript array is empty? Here is a little trick I found online. I was assuming that there was a some sort of built in function to test if the array but not so.   The trick is to check if the length of  the array is less than 1.


For example

if (theTestArray.length < 1)
alert (‘Array Is Empty’);




How I Plan on Accomplishing My Goal

Posted in All, Entrepreneurship on June 6th, 2011 by Jarred – Comments Off on 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

Posted in All, Geekdom on June 5th, 2011 by Jarred – Comments Off on 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…