Posted by: craigbbaker | February 26, 2008

Back to Work

I’ve had a great couple of months on my sabbatical, but the time is right for me to return to work, well at least the kind that pays the bills. I’m taking on a 3 month contract at Sensis in the location and wireless division, which aligns well with my current professional interests.

I’m going to miss the startup life, the unbounded possibilities, is a real motivator. I’m not talking about the financial successes that startups are often associated with, but the opportunity to create something that has the potential to change the world. I’m not suggesting that large corporates can’t innovate, they just can’t innovate with the same intensity.

I’m not sure what comes next but I do know which direction to look.

Posted by: craigbbaker | February 25, 2008

Elimatta location-blogging for Android

create channelA new project Elimatta I’ve been working on, is what I’m calling location-blogging. It’s not really like a blog, but it’s the quickest way for me to describe the concept. It’s probably more akin to a tumblelog where anyone who is physically located in an area can post. This is how I describe the idea on the projects site.

“Elimatta can be most easily understood as a location based blog. The idea is that people should be able to communicate with others in a shared location, in an adhoc fashion. The application centers around the concept of channels which are specific for a given geographic area, large or small. Channels permit postings, (similar to blog postings), by individuals located within the bounds of the channels geographic active region. Individuals outside the active region are only permitted to view the channel.”

The client application has been written for the Android OS and is currently available in an alpha release for interested persons to play with.

Google’s Android initiative shows much promise and from a technical perspective is very impressive. Commercially the project will have many mountains to climb before consumers can have a chance to access an open mobile computing ecosystem. I genuinely believe we are at the dawn of the next revolution in computing where mobile devices will play a significant part in connecting humans to life enhancing knowledge. So any attempt to bring us closer to that dream should be encouraged, even if organizations have vested interests in the commercialization of such technologies.

Posted by: craigbbaker | January 27, 2008

Australia Day 2008 – “Carn The Aussies”

My grandfather, Merv Kurts wrote this poem for Australia Day.

Corey

Australians are a funny lot, you’ll often hear them curse,

How things have started badly, and will probably get much worse,

The weathers dry, the sun’s so hot, it’s stolen all the water,

The Government never does the things we think they “really oughter”.

But if we hear a tourist say, “his home is far- far grander”,

They’ll find they’ll soon be told, “to take another Gander”.

For though we Aussies may complain, at what’s become our lot,

When someone knocks this country, we give’m all we’ve got.

We may criticise some teenage brat, may even wish them failure,

But we stand behind them cheering, when they’re playing for Australia.

Because, if this is home to you, the country of your birth,

Then you’ll back the “Aussie” battler, to beat anyone on earth.

When the cricket bats are swinging, or when someone scores a try,

When a local horse has won the cup, and made the owner cry,

When some paralympic athlete hits the front and sets the pace,

You’ll hear ‘ Aussie Aussie Aussie’ as they go right off their face.

And although some like to take a break, in an overseas location,

If you take the time to question this nomadic population,

They’ll tell you without blinking, “That wherever they might roam,

The best part of the journey, was the last bit …… coming home”.

For the sun was never brighter on the beaches any- where,

Than it is upon the sandy shores, Australia has to share

The water never purer, nor the air as fresh and clear,

The people not as friendly, as those you meet, back here.

If you venture to the outback where grass is scarce as snow,

As you swelter you may wonder “whatever made you go”,

But when you talk to “locals”, who have been there since their birth,

You’ll never find a better bunch of folk upon this earth.

All across this wide brown country, from the Cape to Hobart town,

There are people who will help you, when you find the chips are down,

And if someone should abuse you, and does it “just because”.

You can bet he’s not an Aussie, and probably “never was’.

So when you feel disgruntled, just remember this rendition,

And don’t blame the whole country , for the acts of politicians,

Look up and count your blessings, when you see our flag unfurled,

And be glad that you are living in,

THE BEST COUNTRY IN THE WORLD!

Posted by: craigbbaker | January 3, 2008

Android on Smack

Note this examlpe won’t work with the lastest Android builds 1.0+, sorry.

This post provides some details on the complexities of sending a GoogleData message from  an Android client to standalone server using XMPP. The XMPP data messages can be used as a message bus for pushing information between Android and a standalone server. Post assumes basic knowledge of Android’s XMPP capabilities and the Smack API. Sorry I’m being really lazy and skipping a lot of detail, maybe if I get some interest I might come back and fill in the blanks.

One of the first gotchas to get this working is to inform android that the jid and resource name that you want to send a message to are ‘google data message capable’. You can do this  manually by navigating to the database in the following directory using the adb shell;

data/com.google.android.providers.im

and running this insert statement substituting bare_jid and resource values with your required IM endpoint.

insert into xmppDataMessageCapable (bare_jid, resource) values (’bob@gmail.com’,’server’);

Alternatively you can use the following code to enable google data sending for a given JID and resource via androids XmppDataMessageCapable provider.

public class DataEnabledApplication extends Application
{
	private static final String[] XMPPDATACAPABLE_PROJECTION = new String[] { Im.XmppDataMessageCapable.BARE_JID, Im.XmppDataMessageCapable.RESOURCE };
	private static final ContentURI XMPPDATACAPABLE_CONTENT_URI = ContentURI.create("content://im/xmppDataMessageCapable");
	private static final String XMPPDATACAPABLE_SELECTION = Im.XmppDataMessageCapable.BARE_JID + " = ? AND " + Im.XmppDataMessageCapable.RESOURCE + " = ?";
	private static final String[] XMPPDATACAPABLE_SELECTION_ARGS = {BullroarerXmpp.BARE_JID, BullroarerXmpp.RESOURCE};

	/**
	 * In order to push XMMP message to the server JID we need to list the JID as data capable
	 */
	private void setupServerJIDforGoogleData() {
		IContentProvider provider = getContentResolver().getProvider(XMPPDATACAPABLE_CONTENT_URI);
		Cursor cursor = null;
		try {
			cursor = provider.query(XMPPDATACAPABLE_CONTENT_URI, XMPPDATACAPABLE_PROJECTION, XMPPDATACAPABLE_SELECTION,
									XMPPDATACAPABLE_SELECTION_ARGS, null, null, null);
			if (!cursor.first()) {
				ContentValues initialValues = new ContentValues();
				initialValues.put(Im.XmppDataMessageCapable.BARE_JID, BARE_JID);
				initialValues.put(Im.XmppDataMessageCapable.RESOURCE, RESOURCE);
				provider.insert(XMPPDATACAPABLE_CONTENT_URI, initialValues);
			}
		} catch (DeadObjectException e) {
			Log.i(LOG_TAG, "unable to setup " + FULL_JID + "as data capable", e);
			notificationHelper.logMessage("unable to initalise communication provider (see logs)");
		} finally {
			if (cursor != null)
				cursor.close();
		}
	}
}

Now you will be able to send an XMPP message to any given Jabber JID, our goal is to send the message to a JID end point on a standalone server process. For more help with sending XMPP message from andoird have a look at the samples in the google documentation or this post.To handle the received messages on the server end we will use a custom smack extension. The code for the extension is below, see smack documentation for instructions on how to use these classes.

/*
 * Copyright (C) 2007 Craig B Baker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.elimatta.xmpp.x;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.xmlpull.v1.XmlPullParser;

/**
 * @author Craig Baker
 * @version $Id$
 *
 * http://kickjava.com/src/org/jivesoftware/smackx/provider/DataFormProvider.java.htm
 * <a href="http://kickjava.com/src/DelayExtensionProvider.java.htm" mce_href="http://kickjava.com/src/DelayExtensionProvider.java.htm">http://kickjava.com/src/DelayExtensionProvider.java.htm
</a> */
public class GoogleDataPacketExtensionProvider implements PacketExtensionProvider
{

    /**
     * Creates a new GoogleDataPacketExtensionProvider.
     * ProviderManager requires that every PacketExtensionProvider has a public, no-argument constructor
     */
    public GoogleDataPacketExtensionProvider()
    {
    }

    /** Installs the provider. */
    public static void install(ProviderManager manager)
    {
        manager.addExtensionProvider("x", GoogleXmppDataExtension.NAMESPACE, new GoogleDataPacketExtensionProvider());
    }

    public PacketExtension parseExtension(XmlPullParser parser) throws Exception
    {
        GoogleXmppDataExtension result = new GoogleXmppDataExtension();
        int c = parser.getAttributeCount();
        String name;
        String value;
        for (int i = 0; i < c; i++)
        {
            value = parser.getAttributeValue(i);
            name = parser.getAttributeName(i);
            if (name.equals("intent_action"))
            {
                result.setIntentAction(value);
            }
            if (name.equals("token"))
            {
                result.setToken(value);
            }
        }

        boolean done = false;
                 while (!done) {
                         int eventType = parser.next();
                         if (eventType == XmlPullParser.START_TAG) {
                             if (parser.getName().equals("app-data")) {
                                 result.addAppData(parseAppData(parser));
                             }
                         } else if (eventType == XmlPullParser.END_TAG) {
                             if (parser.getName().equals(result.getElementName())) {
                                 done = true;
                             }
                         }
                 }
        return result;
    }

    private GoogleXmppDataExtension.AppData parseAppData(XmlPullParser parser) throws Exception
    {
        final String type = parser.getAttributeValue("", "type");
        final String value = parser.nextText();

        return new GoogleXmppDataExtension.AppData(type, value);
    }

}
/*
 * Copyright (C) 2007 Craig B Baker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.elimatta.xmpp.x;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.jivesoftware.smack.packet.PacketExtension;

/**
 * Google Data Message extension
 *
 * @author Craig Baker
 *
 * http://kickjava.com/src/org/jivesoftware/smackx/packet/MUCUser.java.htm
 */
public class GoogleXmppDataExtension implements PacketExtension
{
    public static final String NAMESPACE = "google:data-msg";

    private String intentAction;
    private String token = "P8s0A-0";
    private Set appDatas;
    public String getElementName()
    {
        return "x";
    }

    public String getNamespace()
    {
        return NAMESPACE;
    }

    public String toXML()
    {
        final StringBuffer buf = new StringBuffer();
        buf.append("");

        if (appDatas != null)
        {
            for (AppData data : appDatas)
            {
                buf.append(data.toXML());
            }
        }

        buf.append("");
        return buf.toString();
    }

    public void setIntentAction(String intentAction)
    {
        this.intentAction = intentAction;
    }

    public String getIntentAction()
    {
        return this.intentAction;
    }

    public void setToken(String token)
    {
        this.token = token;
    }

    public String getToken()
    {
        return this.token;
    }

    public Set getAppData()
    {
        if (appDatas == null)
            Collections. emptySet();

        return appDatas;
    }

    public Map getAppDataMap()
    {
        Map dataMap = new HashMap();
        for (AppData appData : appDatas)
        {
            dataMap.put(appData.getType(), appData.getData());
        }
        return dataMap;
    }

    public void addAppData(AppData appData)
    {
        if (appData == null)
            throw new IllegalArgumentException("app data can not be null");

        if (appDatas == null)
            appDatas = new HashSet();

        appDatas.add(appData);
    }

    public static class AppData
    {
        private String type;
        private String data;

        public AppData(String type, String data)
        {
            this.type = type;
            this.data = data;
        }

        public String getType()
        {
            return type;
        }

        public void setType(String type)
        {
            this.type = type;
        }

        public String getData()
        {
            return data;
        }

        public void setData(String data)
        {
            this.data = data;
        }

        public String toXML()
        {
            StringBuffer buf = new StringBuffer();
            buf.append("");
            if (getData() != null)
            {
                buf.append(getData());
            }
            buf.append("");
            return buf.toString();
        }

        @Override
        public String toString()
        {
            return type + ":" + data;
        }
    };

    /**
     * TODO - implement
     */
    @Override
    public boolean equals(Object obj)
    {
        return super.equals(obj);
    }

    @Override
    public String toString()
    {
        StringBuffer buf = new StringBuffer();

        buf.append("intentAction:" + getIntentAction() + ",");
        buf.append("token:" + getToken() + ",");
        buf.append("app-data:");
        for (GoogleXmppDataExtension.AppData data : getAppData())
        {
            buf.append("[" + data + "];");
        }
        return buf.toString();
    }
}

Posted by: craigbbaker | December 27, 2007

Outlook – Uninstall

It has been a long time coming, but I was able to finally break my dependency on Microsoft Outlook. I’ve proven myself time and time again completely incapable of managing my own email, it’s time I left it to the experts. I’m uploading the last of my desktop email archives to Amazon S3, that is where it belongs, in the cloud.

As for offline email Mozilla Thunderbird is more than enough and I’m sure my Mac and Linux friends will appreciate not receiving jumbled ASCII ever time I want to setup a meeting now.

Farewell my fair weather friend.

Posted by: craigbbaker | December 21, 2007

Tangler – Sign Out

Today is my final day at Tangler. I am very proud of what has been achieved over the last couple of years and look forward to seeing Tangler achieve its full potential.

sign out

May the web 2.0 Gods smile upon you.

Posted by: craigbbaker | October 22, 2007

NEW_URL:blog.craigbbaker.com

Can my three subscribers (including myself) please update their subscriptions to http://blog.craigbbaker.com. This is going to kill my page rank!

Posted by: craigbbaker | August 20, 2007

Skype lets you edit instant messages.

I just discovered this neat feature that has been added to Skype (I’m running v3.5.0.202). You can now edit your previous chat messages. Simply hit the up arrow, edit away and hit enter. Your previous message will be updated in the chat history. Or you can right click the message and select edit from a menu. This is a very simple feature addition, but really valuable for people like me that mistype/misspell a high percentage of words.

skype.jpg

Posted by: craigbbaker | July 8, 2007

7 year old girl implements Pet Store in Java

Posted by: craigbbaker | June 2, 2007

Dell’s Core 2 Duo Con

Dell are misleading consumers by labeling Intel Core Duo (Yonah) processors as Core 2 Duo (Merom) processors. The T2450 processor is clearly labeled as a Core 2 Duo, offending page on Dell ‘s online store. I’m sure they will claim it is an innocent mistake. It’s certainly a very profitable mistake, how many Dell customers will actually realized they have been duped?

dell_core2duo_con.jpg

Older Posts »

Categories

Follow

Get every new post delivered to your Inbox.