Friday, 13 August 2010

Creating a multiple page GWT app

I've been playing with GWt for a little while in my spare time. Just expanding the stockwatcher tutorial I talked about before. and experimenting with a few ideas. I've been wondering for a while how to link up multiple pages and start building a more complex app.

Well, I I've just figured out the way that works for me. Thought I'd post it for any one else that's confused. I'll start by taking you through the journey that led me here.

First I had to accept that GWT is about building Advanced AJAX based applications. Just like desktop applications you only get one entry point. So how do you navigate around? Turns out GWT has an Anchor tag and you can easily assign click events to it.

A quick test later and I found that the simplest solution was to create a new load method for the page I wanted to create. Whether I create a new class or not is not the point. I just wanted to prove I could control the onscreen components and use the underlying divs much like a canvas to paint on. I found that I could clear the canvas using RootPanel.get("root div name").clear().

ok, so hopefully it's becoming clearer. To put this example together I've included code snippets that hopefully explain this in much more detail. I've only included the key details assuming you've filled in the other aspects like creating a proper loadPage method. I've just been using that from the stockwatcher tutorial for simplicity

//instantiate the link
private Anchor prototypeLink = new Anchor("Prototype");


// append link to a display panel and assign a click event.
loadPage(){ 
   prototypeLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) {         
       loadPrototype(); } 
   }); 
   .....

   mainPanel.add(prototypeLink);

}


 // Then create the destination method and see what we can change
protected void loadPrototype() { 
   // clear the app name
   RootPanel.get("appTitle").clear();
  // add a new app name
   RootPanel.get("appTitle").add(new Label("Prototype")); 


   // clear the canvas
   RootPanel.get("activityList").clear()

   // add a panel
   RootPanel.get("activityList").add(currentActivityFlexTable);
}


The point of all this is that I learnt that I can clear the canvas. So I can paint and clear it at will. I can also therefore keep multiple views loaded but only display them when necessary. That's my assumption any way.


Just hope this helps.

Wednesday, 4 August 2010

Does the human body crave the foods it requires?

CravingImage by ex.libris via Flickr

I just found a post I really had to comment on. Couldn't find a way to link it back here so just thought I'd do it myself. The question was Does the human body crave the foods it requires?

Good point I thought. So I went on a little tirade that I want to keep for posterity. Hopefully it puts my thoughts into a succinct couple of paragraphs.

Everything I see and learn reinforces my view that we are built, just like all other animals, to survive. So our genes will play some part in telling us what to eat but I feel we just learn a lot very quickly when we're young.
We copy everyone around us. We put worms and dirt in our mouths and our parents scold us. Babies will try just 
anything. Parents just protect them from the dangerous stuff. All this experience becomes part of us because it trains our systems, nervous, emotional, physical and the rest of it.
When we're sick cos we ate something bad our bodies are designed to associate it with what made us sick. that's our evolutionary response and in our DNA. We're different to animals in that we override this. Rats undernourished naturally chose food that replaced lost nutrients, humans don't. alcoholics have cronic vitamin defficiency but don't fix it.
So I'd argue that humans are ruled by their minds and emotions far more than animals. We actually learn to ignore our natural instincts infavour of cultural norms and personal preferences.

So, yes I think we genuinely can detect what's in our food, and eat appropriate foods to get the right balance. I just think our lifestyles encourage us to ignore this and we don't really learn how to listen. 

Enhanced by Zemanta

Tuesday, 3 August 2010

Google and Apple are both winning in the mobile markets, they just have different goals

Android Eats AppleImage by Jan Tik via Flickr
I just felt I'd put a few comments together that have been bugging me for a little while.

Firstly that while we're seeing a huge amount of innovation at the moment I think we can have a pretty good idea of at least some of the ways in which it will all settle down. History is full of examples of innovation and shows that over time there's generally a pattern.

The web, mobile and other areas are so young that it's anyones guess what the long term revenue models will be. In truth though I don't think it's hard to guess. Newspapers, magazines, tv, radio have, for decades survived very well on advertising for the simple reason that it removes the biggest barrier to getting customers, asking for money. By just delivering content free or hugely subsidised as in newspapers and magazines you can deliver at scale.

I just read about Googles success on their mobile operating system named Android. I like the article. It's the first I've seen that makes clear the similarities yet clear differences between Apples and Googles approach to monetising the mobile market.

My simple view is that charging upfront generally limits your market size because it presents an important hurdle to getting into the product or service. Hence I can't see Apple selling as many devices long term as those running Google. Apple will do very well and get maybe 10% of the market (who can really predict the amount) but Google can and most definitely will get atleast 50% (Don't forget there are other big players like HP and RIM who want a piece of the pie too)

The reason., because Googles Android is free to the user, Apples is not. Apple charges a premium for the quality and reliability of its products, but its core strength is its biggest weakness in terms of scale. Apple just can't deliver features at the rate and cost that Google can because Apples features must be perfect before release, but Googles don't have to be. Googlers are more like explorers who expect freedom to do as they wish with their device. Apples fans want things to 'just work' and will accept limitations in design to get this. All this control and attention to detail costs money and takes time.

So, in my view, it's never been a war. It's just two different approaches to delivering mobile markets. Both are delivering amazing results to their fans but their philosophy will ultimately determine who leads in each mesasure. Apple will always have quality and security at cost. Google will eventually get scale and flexibility and value for money.

The Microsoft and Apple story was similar for similar reasons. Microsofts goal was scale, Apples, quality. It's not the only time this has played out. It just seems that way.

History has countless stories of similar rivalries. England has such a long history of new money vs old money. The new way of doing things vs the old way.  In the UK Power used to be held by just a few lords and one monarch and then a few people below them. Over time there have been countless struggles with new ideas outcompeting the old ideas. It's just evolution. Those who survive adapt. Old powerful families either found a place in the new order by, either fading into the background whilst holding onto their powerful links. Keeping power and wealth by helping those in power. They just get less attention, or they adopt the new ways and find a way to make a living.

The English monarchy are a good example since they're very much a German family by heritage. However, like many families at the turn of last century, they changed their name to Windsor and adjusted to the new order that was coming. They avoided the dissolution of the monarchy by giving back much more power and started showing what the monarchy could do for the country instead of the people having to do everything for their monarchy. This was just part of a long political struggle going on throughout the UK and the world in general.

While it may seem a stretch to compare the changing attitudes to the monarchy with a struggle between two heavy weight computer companies I feel it is just because it's still all about people and their dreams. Not everyone has money and power but everyone has dreams. My dream is all about freedom and that includes freedom from software and hardware.

I see Apples approach as dictatorial, the opposite of free. I envy what so many iphone users can achieve but I won't put money and effort into a product that's designed to tie me down. Mainly because I don't feel Apple can fulfil my dreams in the long term. I feel I will never be free because every advance comes at a financial cost. One that I may not be able to bear in time.

I also cannot think of a dictatorial country that has managed to compete equally with one where democracy rules. The main reason is that democracy encourages competition and free thought. Free thought in a competitive environment encourages innovation and constant improvement, constant evolution of process.

Google on the other hand is obviously more of a democracy. What I lose in clear decisions and straightforward approaches, I gain in freedom to achieve anything I put my mind to. I know that there will always be an android device within my price bracket and that Google will always care about me as an individual. Regardless of my situation they will want to support me. Their business model is designed that way. Democracy has led to openness. Each generation seems to be more open than the last. Mainly because we all seem to benefit from removing barriers and because new tech and ideology removes barriers.

I also feel that Apple essentially does all the development itself. Sure there are tons of apps that they didn't write but I'm talking more about the core of their products. Googles fundamental belief is about bringing people into their products in any way they can. Many of the 3rd party improvements to the Android operating system have been incorporated into the core release, apps2sd is a recent addition to name but one. Further to that I've found it easy to comment on and suggest new features to every Google product I've wanted support on.  I don't know of this happening with Apple. They're certainly not quick to explain the meat behind any  issue that arises in their products.

Ok, I feel like I'm starting to go on a tirade. The main point I wanted to make is that they're both winning. They've just got different goals. These are not new goals. Individuals, companies and even countries have  had these goals before and history is littered with how these worked out. Each company will win different types of customers because their followers will have different dreams. the dreams you have often determine the sacrifices you're prepared to make. So those behind Google and Apple are likely to have different ideas about the sacrifices they'll make to achieve that dream. I just think that, long term, Googles dream is cheaper and brings freedom. Apples makes you addicted to perfection which is an impossible dream so you'll never be free. And I think the worlds history on democracy over dictatorships bears out the idea that democracy will win long term. That's my hope anyway.

So this kind of competition is common. It happens every so often in most markets and the outcomes do have patterns. I haven't done an in depth analysis. Just thought I'd put my ideas down so I can see if they pan out or not. See if I'm talking nonsense :-).
Enhanced by Zemanta

Sunday, 25 July 2010

Simon Sinek: How great leaders inspire action - Simon Sinek (2009)

I just heard this talk and had to share it. It's helped me understand why I achieve things and shows how focusing on money rewards is a recipe for failure not success. It's my mantra but it's explained so eloquently in this piece.

Simon Sinek: How great leaders inspire action - Simon Sinek (2009): "Simon Sinek has a simple but powerful model for inspirational leadership all starting with a golden circle and the question 'Why?' His examples include Apple, Martin Luther King, and the Wright brothers -- and as a counterpoint Tivo, which (until a recent court victory that tripled its stock price) appeared to be struggling."

Monday, 5 July 2010

Creating a school that teaches through games

So, I've always felt that games are fantastics tools and experiences in which to teach and to learn. I'm finding more and more that I'm not alone in this view. Over the weekend I heard about a fantastic new school called quest to learn in New York that has taken this concept to the classroom.

Reading through their website I'm really impressed by the approach I'm hearing about and just wanted to spread the word. Here's a great video that explains the concept

Friday, 11 June 2010

False economies. Software development and pcs. Should you demand the best machine?

I've always wondered as a software developer whether a highered powered machine would be a good investment for the company I work for. Many purchasing decisions are made by accountants and sometimes managers with no input from the people who actually use the machines. They believe that a £400-£600 machine is fit for a developer and that it should be replaced every 5 years. Yet they're happy to pay a developer £35k  I think this is a false economy. Every day I'm at work I can only do as much as my machine allows me to do. It's the same as a farmer using a 10 year old tractor and combine harvester or a new one. You'd expect the new ones to cost a little more (given inflation) but also do a lot more work in the same time. 

I just thought I'd put a short analysis together and see if I can make the argument that it's actually more efficient to give a software developer a better machine because the return on investment will be huge.

I mentioned a salary of £35k. What does that mean per day? Google says there are 252 working days per year. £35000/252 = £139/day. so in a working week my employer will pay me £695(£139x5). I know these figures aren't exact but they're close enough and make the point. The most important tool I have as a developer is my computer. It's the equivalent of a chefs knife, an accountants balance sheet and a printers press. You don't give a chef a shabby knife do you. so why do I get a less than adequate machine. And why do I have to keep this low spec machine for another 5 years. 

Another thing I've noticed is that companies are happy to pay for photoshop licenses (£800 or so), they don't ask graphic designers to use gimp (a free open source product that's excellent but not quite so polished), they'll pay for xml spy for xml developers, for ms office for all, and shell out for ms project. All these products have annual license fees which they don't quibble about paying. I could get a much better machine just by reducing my reliance on these products. That's what I've done but no one has thanked me for it and allowed me to spend the difference on a better machine as a thankyou.

Yet no one considers the value that each item of software delivers is related to the power of the machine it runs on. Developers are the same as graphic artists. Many tasks are intensive. Even searching the code base takes a minute or so and I do that regularly. We get a machine that costs £400 and use it for 5 years. That seems to be the policy of many companies, £80/per year/machine. It makes no sense to me when we pay far more for just one item of software. 

Being a developer means my machine is my most important tool. It's the one thing I use for 7.5 hours a day. So I don't see why it's the tool we spend the least on. Particlulary when I makes specific choices to save money  in license fees for the company I work for. I don't use ms office or outlook, and I use many free but highly rated products.  

I'll stop there but now I've had a little rant I also don't feel like I'm being silly or selfish. The same policy applied where I used to work. It was no coincidence that I delivered sooner and to a higher quality after I fought for a better machine. I'm a software developer. My work is very different to the rest of the company. Therefore I require tools fit for my needs not theirs.

This isn't me just venting and wondering if I am making any points I could potentially take further. After this rant I see that I do have specific needs. I'm just asking for them to be recognised.