Tuesday, April 28, 2009

Can Silverlight save the world?

A recent article on the CO2 cost of spam, 17 million tons of the stuff apparently, and a conversation I had with a friend about the economic advantages of parallel processing systems made me think about how technologies such as Silverlight, Ajax and Flash can act to reduce the carbon emissions associated with internet operations.

You see, traditional internet systems, web pages and the like, are a "projected user interface" that really exists on the server and are constantly refreshed whenever we select another link or move to another part of the web application. If we think about the operations taking place here, we see that the server is sending out masses of data that is often duplicated. A web-page refresh from a dynamic site for example, sends the whole HTML data stream to the client each time. A click of the refresh button may not seem expensive but when we factor in the cost of transporting that information across thousands of miles of cable, the electrical burden becomes significant.

So, why might Silverlight save the world? Well, by making a large percentage of the intelligence of a web application reside on the client PC, the data burden is reduced over the network. Rather than re-sending all the HTML information for the pages the data is reduced to the necessary information such as data from web-services. Less data means less current to the data centers and less power for the network infrastructure.

Monday, April 13, 2009

A weekend without computers (except iPhones)

So during the Easter break we went to our old house which we're renovating and tried out Trakkus on three clients. To test the system properly my wife and son have signed up for iPhone accounts, they have the 8 gig versions which are on special offer of 99 euros at the moment. Even with my entire music collection, some of which I never-ever listen to, on my 16 gig model I have 6 gigs free so it seems that one would have to be a serious memory hog to use up even the eight gigabyte model.

All three systems have performed well and I have identified some improvements to the system which will be implemented as soon as possible. First I am going to put the display of the web-pages used by the iPhone client into the web client component rather than call out to Safari. This will enable the client to remain up for longer.

I also need to put an image capture button on the beacon dropper so that users can add a snap to the beacon.

Interestingly again this week, even though I took a laptop with me, I didn't use it except to watch a DVD on Saturday evening. All of our out-and-about computing needs were serviced by the iPhones, including one little bug-fix that I did at a distance by driving my PC here via Logmein running on the iPhone.

Before I left I tried setting up ad-hoc distribution via an iTunes account on a PC. I packages the provisioning profile and the .app install file and mailed it to my wife who was able to install it to the iPhone using drag and drop via the iTunes account she uses on her PC. This means that I can indeed distribute this to up to 100 machines for beta test purposes.

If you know anyone who would like to participate in the beta test send mail to beta@trakkus.com where I will make all the necessary arrangements.

Friday, April 10, 2009

PC vs Mac

I think I can say with all honesty that I have been dispassionate and open in all of my attitudes towards platform partisanship. It was nothing more than an accident of fate that I began programming for Windows. Actually, I bought my first PC in 1985 to do cross platform development using z80 assembler running on Spectrum computers. In those days Windows didn't even exist and Microsoft was just a small company in the USA.

My first project as an independent consultant was on a mouse for that Spectrum system which I prototyped using an Apple mouse. I had seen Mac Paint and loved it so much I wanted to do something myself, just to see how and the AMX mouse was born from that.

Later, I worked in the printing industry that used Macintosh systems for page makeup but chose PC hardware instead because of cost concerns when we had to create hardware for the systems I was designing.

Throughout my professional life I have always been seen as a PC oriented person and have often had discussions with techno-bigots as to why I should align myself with the evil empire or how Macs were so easy and friendly to use. I have never subscribed to these ideas though, mainly because really, deep down, I am an embedded systems designer oriented towards hardware and I don’t give a monkeys nuts for such sentiments.

As you know, if you read my blog, my experiences recently have trended towards Apple development for my pet Trakkus project which I have used as a vehicle to enable me to keep up with the broad mix of technologies that my aging middle aged brain needs to absorb. I'll say up front that I really like my Mac. It’s a great little system and has a style of UI which is both simple and elegant. My requirements however do not rest with the need to look at my photos or browse the internet or read my mail.

I am currently typing on my PC while watching my Mac-Mini spinning its wheels in a shutdown sequence which has lasted fifteen minutes and seems to have no sign of ending soon. This is something I was assured by Mac-ites that never happened on a Mac and that Windows was the only system that would waste your time with such unnecessary rubbish.

I have also just wasted my entire morning trying to get my provisioning profiles for Trakkus updated so that I can distribute the software to some of my beta testers. Well, the view from the trenches is that it’s not easy, quick, simple or pleasant to work on Mac development. The development environment is positively stone-age in comparison to Visual Studio and the way that Apple contain and control every tiny aspect of things proprietary to apple is a huge barrier to adoption.

Of course, I intend to continue because I have a financial investment in this idea now and from my first tests I think that it could be a success. I think though that, after having done the research on the ground I now understand why Apple has such a small share of the market despite their obvious skills.

Apple’s adherence to an environment driven by lawyers, licenses, proprietary systems and manic protection of intellectual property has made an environment that is not easy to work in unless you are nothing more than a consumer. Microsoft’s attitude of enabling the developer to adopt their systems has made the process of development so easy that there is almost no second choice.

I can buy a PC from any one of several thousand vendors. I can only buy a Mac from Apple and at an inflated price in relation to the equivalent hardware in the IBM compatible world. My Mac Mini cost me a euro shy of five hundred and I just bought a well equipped ACER PC for my daughter with more memory, more hard-drive and a faster processor for a euro shy of three hundred just a week or so previously.

Seriously, Windows is a better environment, less constrained by legal idiocy, more productive, more accessible, cheaper, does not crash more often, does not take longer to shut down, takes a little longer to boot up – unless you’re running Windows 7 which is similar to the Mac, if not a wee bit faster- and wins hands down in my opinion.

To be fair, I love my iPhone. It is my most used piece of hardware ever. I like my Mac mini. It’s simple, elegant and fun to use. I think though, pragmatically, and as my tee-shirt currently reads; “I’m a PC”

Tuesday, April 07, 2009

Sneak peek..

Would you like to see how Trakkus looks in real life? Well, for a short time I am going to allow anyone to view where I go when my iPhone client is turned on.

To get a look at the system when its running simply hit this link too see a limited snapshot of my movements.

Please note that I have altered the values to protect my real position.

I still need beta testers for the system for a month or so and anyone who assists in this test will receive a complementary copy of the full version of the software.

Monday, April 06, 2009

Getting greater position accuracy from the iPhone

The iPhone client for Trakkus uses the CLLocationManager to obtain readings. The classic method for getting the reading is to set the location manager going and wait for it to call back your delegate, didUpdateToLocation, with a reading. At this point you can immediately turn off the location manager by calling the stopUpdatingLocation method or you can check the accuracy of the location you have to see if you like it.

The CLLocation horizontalAccuracy setting is a double value that gives an estimated distance accuracy and there are some constants such as kCLLocationAccuracyHundredMeters or kCLLocationAccuracyTenMeters that you can compare the value with or just look at the value to see if it's within your desired accuracy.

If this horizontal accuracy is negative (invalid) or larger than you like, don't turn of the location manager yet. Leave it running and get a better reading.

Here's a snippet...

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{

NSDate* eventDate = newLocation.timestamp;
NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
if (abs(howRecent) < 5.0)
{
if(!signbit(newLocation.horizontalAccuracy) && newLocation.horizontalAccuracy <= kCLLocationAccuracyHundredMeters)
{
[locationManager stopUpdatingLocation];
TUser *presentUser = [Singleton singleton].currentUser;
NSString *tlat = [NSString stringWithFormat:@"%+.6f",newLocation.coordinate.latitude];
NSString *tlong = [NSString stringWithFormat:@"%+.6f",newLocation.coordinate.longitude];
if(![tlat isEqualToString:presentUser.latitude] || ![tlong isEqualToString:presentUser.longitude])
{
presentUser.latitude = tlat;
presentUser.longitude = tlong;

[NSThread detachNewThreadSelector:@selector(submitLocation:) toTarget:self withObject:presentUser];
}
}
}

}

(hey, that's my first Cocoa code posting ;-) )

Trakkus tracked me.

Trakkus is my pet project. It's social networking and geolocation. (See here...)
I have an iPhone client that connects to services to report locations and to provide options such as chosing who is allowed to see where you are and to drop markers on the maps.

I have discovered that I can use an Apple application such as the iPod player or iTunes to listen to a podcast or some music and Trakkus will continue to run in the foreground and update positions.

This means that the system will indeed be useable for, say, my wife who may wish to see where I am on the way to or from work or for a parent to see where a child is, without having to reduce the functionality of the iPhone.

Sunday, April 05, 2009

Back for another round.

There are few things that make me proud in my professional life but the Microsoft MVP award is one of those things that just makes me hugely happy.
I was re-awarded Visual C# MVP again this month for 2009.

About time too!

I guess I wasn't the only person to have problems with the complexity of the Apple developer program's ad-hoc provisioning profile which is used to put programs you write onto an iPhone for testing.
Their site now has a set of extremely succinct videos on how to accomplish this task and what purpose the steps serve.

My test app for Trakkus is up and running and I am looking for iPhone owners to beta test it.

I cannot have an unlimited number of testers I have three spoken for already and so I would like a total of about 50 from various locations in the world.

If you have an iPhone 3G with the 2.2.1 operating system and an interest in testing a geolocation application then scootch over to http://www.trakkus.com and look at the details of the test.

I will only accept first comers and the application will be buggy ;-)