Archive for the ‘Uncategorized’ Category

* Mobile Geolocation Implementations

Posted on August 19th, 2010 by Dave Johnson. Filed under Uncategorized, phonegap.


Today I found some time to take a look at the various mobile implementations of geolocation.

Below is a table showing the properties that the geolocation API uses on the various platforms. The W3C geolocation API for browsers specifies a PositionOptions interface that requires a maximum age, timeout and accuracy. Below that row is all of the mobile platforms that we are interested in for PhoneGap and the properties that they support in their native implementations. Some of them support a distance filter that will cause the device to only return geolocation positions if the location has changed by more than that distance while others also support an explicit interval for watching for location changes (note that on Android that interval is only a hint to let the device know how much power to use in getting a location - the position may be reported at an interval either shorter or longer than the specified interval).

I am probably going to be adding these two additional arguments to the PhoneGap PositionOptions and they can be used on platforms that support them.

Max age Timeout Accuracy Distance Interval
W3C X X X
BlackBerry maxAge timeout - - interval
iPhone - - desiredAccuracy distanceFilter -
Android - - - minDistance minTime
webOS maximumAge responseTime accuracy - -
WRT updateMaxAge updateTimeout - - updateInterval
Winphone - - DesiredAccuracy MovementThreshold

Image from cloneofsnake

Tags: , , , .



* PhoneGap and BlackBerry OS 6

Posted on August 5th, 2010 by Dave Johnson. Filed under Uncategorized.


RIM OS 6 for BlackBerry smartphones is being released very soon on the new BlackBerry Torch 9800.

It looks like a pretty nice upgrade from OS 5, most notably including a WebKit based browser. This should be a *huge* improvement for PhoneGap on BlackBerry.

The bad news is that OS 6 will not work on a lot of the older hardware. OS 6 will run on the following:

  • Storm 3 (as yet unreleased)
  • Bold 9700
  • Bold 9650
  • Perl 9100

Notable devices missing from that list are the original Bold 9000 and the Storm 1 and 2. Those will be stuck on OS 5.

The kicker here is that anecdotally, and based on AdMob stats from April 2010, the most widely used RIM devices (remember AdMob stats represent devices that ads are being served to) are from the BlackBerry Curve line 8300 and 8520 in the US and UK respectively.

The tentative plan for PhoneGap on BlackBerry is likely going to be a “final” release for BlackBerry 4.6 / 4.7 tagged on Github (sometime in the near future) and then shifting focus to BlackBerry Widgets on OS 5 and 6.

.



* BlackBerry JavaScript Oddities

Posted on July 18th, 2010 by Dave Johnson. Filed under Uncategorized.


I have just discovered that the Element object in the BlackBerry browser (4.6+) supports the prototype object on some objects but not others. In particular the Element object supports it like this:

1
2
3
Element.prototype.addEventListener = function() {
    alert('foo');
};

but the following does not work on the Document object:

1
2
3
Document.prototype.addEventListener = function() {
    alert('bar');
};

What does work on the Document is overriding instance method like this:

1
2
3
document.addEventListener = function() {
    alert('foobar');
};

Strange but true!

If you have any other BlackBerry tidbits please let me know since these old versions of BlackBerry browser are going to be the IE6 of the the mobile web.

.



* Passenger on Rails Playground

Posted on August 29th, 2009 by Dave Johnson. Filed under Uncategorized.


I finally setup Passenger (mod_rails) on my Rails Playground server the other day so that I can quit worrying about Mongrel and it is super easy. The main problem that I found was that I had a spelling mistake in my httpd.conf file in the PassengerRuby config line. The error that this produced in the Apache error_log file seemed to be referring to starting the spawn server.

Could not start the spawn server: /usr/local/lib/ruby: Permission denied (13)

So I spent a long time trying to find info about Passenger spawn server settings, but the problem in the end was that the path shown in the error did not exist - it should have been pointing to bin obviously :S

The other part of using passenger is the slightly different Capistrano recipe. With Passenger there is no spinner task and you need to put in an empty restart task. Here is my recipe:

########################
# Application
########################

set :application, “example.com”
set :deploy_to, “/var/rails/#{application}”

########################
# Settings
########################

default_run_options[:pty] = true
ssh_options[:forward_agent] = false
set :runner, “user”

########################
# Servers
########################

set :user, “user”
set :domain, “example.com”
server domain, :app, :web
role :db, domain, :primary => true

########################
# Subversion
########################

set :repository, “http://svn.example.com/trunk/server”
set :scm_username, “user”
set :scm_password, “password”

########################
# Passenger
########################

namespace :passenger do
desc “Restart Application”
task :restart do
run “chown -R apache:apache #{current_path}”
run “touch #{current_path}/tmp/restart.txt”
end
end

after :deploy, “passenger:restart”

deploy.task :start do
# nothing
end

The other thing that I found I had to do was the chown call since Passenger runs the Rails app with the same user as is running Apache, in this case the apache user and apache group.

Now on to try out Cassandra.

.



* Windows Compilation Problems

Posted on May 5th, 2009 by Dave Johnson. Filed under Uncategorized.


If you are trying to use midl.exe but have not before or do not have Visual Studio installed, you may come across a few different errors.

One such error that I had was the following:

“command line error MIDL1001 : cannot open input file oaidl.idl”

So I figured out that I had to get the Windows Platform SDK installed but had a hard time finding it. There is a helpful page on MSDN I found that helps you to choose the right SDK. The link never came up in my search results for some reason and I was only able to find it linked from the Windows SDK blog.

I figured that I would just add that to the PATH environment variable as you may expect to be the case but alas it was not. After a long while of trial and error (mostly error really) I found that you can specify certain paths to be included manually as a command line switch http://msdn.microsoft.com/en-us/library/aa367328(VS.85).aspx

Tags: , .



* JavaScript Pub Sub

Posted on April 28th, 2009 by Dave Johnson. Filed under JavaScript, Uncategorized.


I was talking to someone the other day about the observer pattern in JavaScript and I was reminded about this JavaScript method that is part of Complete UI.

nitobi.Event.prototype.subscribeOnce = function(method, context) {
  var guid = null;
  var _this = this;
  var func1 = function() {
    method.apply(context || null, arguments);
    _this.unSubscribe(guid);
  }
  guid = this.subscribe(func1);
  return guid;
}

subscribeOnce is a special sort of event subscription that rather than being being executed every time the event fires, the handler function is only executed once and then automatically unsubscribed from the event. It is obviously most useful for initialization stuff in JavaScript. There is some more info on JavaScript pub sub over on Ajaxian too.

Tags: , , , .



* On Dell and Social Media

Posted on March 14th, 2009 by Dave Johnson. Filed under Uncategorized.


Yes Twitter can be good for your company. There are of course soon to be urban legends about companies like Dell that made over $1 million during the recent holiday season by using Twitter but what about the sales they lost because of Twitter? I would wager that it could easily be north of $1 million.

Just a quick search on Twitter reveals tweets like this one:

dell laptop locked up two or three times in the last half hour, only button that responded was the powerbutton. Maybe I should send it back

While there may be some good coming from Twitter through marketing opportunities, there is clearly some bad along with that. I think that this is the double edge sword of social media that one must be careful with.

Then there are companies like Mozilla and VMWare or, more specifically, products like Firefox, VMWare Fusion and Harvest that have teams of people constantly watching Twitter and actually responding to your tweets. One time when I was having some VMWare problems @vmwarefusion responded to me almost immediately:

@davejohnson It’s easy enough to find the real culprit. Go to Activity Monitor, and click “Show All Processes.”

not that it ultimately helped much but it’s the thought that counts. To properly take advantage of social media tools like Twitter and get the most out of them this is an important step; it’s about the community engagement rather than leaving them to their own devices. Even though Firefox still crashes on an almost daily basis it does make me feel better when someone reaches out to help. Companies like Dell should be doing the same if they want to see a net benefit from tools like Twitter.

This type of involvement on Twitter really makes sense and it makes the tool more useful even just socially. However, I can see a future in which Twitter could be taken over by people using it more for business relationships using their Twitter network to mine data rather be social. It would get pretty annoying if your Twitter friends starting asking you questions on a daily basis about this product or that, or if companies engage you in a Twitter conversation as a sales tool.

So companies should get out there and engage but don’t be phony about it and be careful not to inundate people with messages.

And, for the record, I am very happy with Dell :)

Tags: , , , , .



* PhoneGap Eclipse Plugin

Posted on February 18th, 2009 by Dave Johnson. Filed under Uncategorized, phonegap.


I have been putting this off for a while but finally got around to getting some Eclipse Plugin action going for PhoneGap.

More news on this very soon!

Tags: , , , .



* Twitter is Currently Down

Posted on February 18th, 2009 by Dave Johnson. Filed under Uncategorized.


Good thing I have a blog to post to instead… ummm so how about those Mets?

Tags: , .



* Sexing Up Home Appliances

Posted on February 9th, 2009 by Dave Johnson. Filed under Energy, Uncategorized.


A few days ago I questioned the cost effectiveness of vehicle electrification as a means to get petrol cars off the road in favour of their electric counterparts that use electricity generated from, in most cases, a fossil fuelled power plant. My thoughts on that still stand in terms of cost effectiveness since an electric hot water heater and furnace might set you back a thousand dollars and reduce emissions by the same order of magnitude as buying a electric car at > $20,000 a piece (not to mention the infrastructure requirements for “fuelling”).

@monkchips thought the post was skeptical but I like to think that it was pretty grounded in reality and if anything painted a more plausible, cheaper, environmentally friendlier and more society friendly than more [electric] cars.

Tom Raftery also commented on the synergies of electric vehicles and vehicle to grid technologies with the stabilization of the grid as well as demand management, which certainly cannot be argued with and I agree that electric vehicles can help with that. Both Tom and James are emminently knowledgeable in this area.

However, I am thinking why not just include a battery bank for your household electricity needs that could be used as local storage for distributed micro-renewable energy generation and, like the electric vehicle battery, help stabilize the grid by taking energy when there is a surplus and giving back when there is a deficit. That way you still avoid some of the high cost of an electric vehicle as well as the infrastructure required for charging and / or battery replacement stations. Electric home appliances can also take part in smart grid demand management through responding to dynamic pricing from utilities helping to stabilize the network and decrease consumption. They are also always plugged in so you don’t need any additional hardware nor do you ever have to remember to plug the car in when you get home. You also just need regular old lead acid batteries rather than super lightweight, high tech batteries made of carbon nanotubes.

I think in general it is a problem of perception. Electric vehicles are undeniably status symbols, as cars have traditionally been and still are in western society. You can’t show off how green you are to your suburban neighbours by buying electric appliances - unless you invite them in to take a look; and we all know that cars make lots of money for companies like Toyota. Therefore, a large part of the discussion is focusing on things that may be good but are not nearly the most effective. Of course now I am leaning dangerously close to a tirade about not just electrification but instead cutting our consumption by using more efficient means of transportation like buses / coaches and cycling. Years ago GM (and others) did of course buy up and dismantle many a railway to promote cars and we are still feeding into their ideas of city design and transportation networks!

I can appreciate the value in electric vehicles and of course in the smart grid and hope to see them rolling on the street soon but I am also hopeful that the influencers in our society start sexing up the image of lower impact transport solutions and other cost effective solutions - especially in this economic climate. However, efficiency or cost effectiveness does not always live up to the hype either as noted by the Khazzoom-Brookes postulate.

So who wants to start making not owning a car cool?

Photo credit: http://flickr.com/photos/djkubik/2386857433/

Tags: , , , , .