Developer42

2009-11-23

Google Wave Robot :: Standard Commands

Filed under: Google, Technology, Wave — Tags: , , , , , , , , , , — Developer42 @ 19:57

Currently each programmer writing a bot for Google Wave is able to write whatever they want, sometimes providing support, but using their own, custom syntax. Having a set of commands which all (or many) bots implement would make the user experience far better, as users would then be able to easily find out how to use the bot, or where to find additional help.
e.g.
botName@appspot.com /? //see /help
botName@appspot.com /help //brings up a list of commands available
botName@appspot.com /about //displays a summary of what this robot does
botName@appspot.com /devsite //provides a link to the developer’s site
botName@appspot.com /mode private //the bot’s responses are only shown to the person who invited it
botName@appspot.com /mode public //everyone in the wave sees the bot’s responses

I’ve also made a summary of this post available on the Google Wave Bots site. Please can you post any responses to that site, as this will allow all communications to be kept in the same place.

2009-11-08

Psychic Site

Filed under: Ideas, Psychology, Technology — Tags: , , , , , , , , — Developer42 @ 16:35

One of the many projects I have queued up to code one day is a psychic site. This isn’t going to be any weird paranormal thing, or a way of ripping people off, but a way of showing what’s possible. The idea is to create a site, where a user fills in a few details, then the site does a cold reading. However, rather than just using the information provided, the site’s able to use information the person didn’t know they were giving to make it appear to be doing the impossible. Useful tools to aid with this are linked below:

Gender Genie. This shows how the language a person uses gives some indication as to their gender.
Polite Software’s Web Spy. This is a security flaw I discovered a while back, which it seems many geeks have worked out for themselves, but is still not that well known. Since you can tell a visited link from an active link by taking advantage of the different CSS style, and reading this using javascript, you can tell which popular sites a person’s been to. You can then use this information to build up a profile of the person, based on the sites and their demographics (e.g. someone who visits facebook is likely to be under 30, whilst someone going to the bbc news site is likely to be over 20).
HTML 5 GEO. HTML 5 introduces an amazing feature; your standard web browser is able to tell your location without requiring GPS. This is done by using GPS where available, your wireless network card to detect signals from various mobile phone masts, then using the strength of each of these signals along with signal strength maps to triangulate your location, your IP address to find the location of your ISP and various other methods. More on how this works can be found here W3 Geo Spec. Getting hold of this info is slightly less covert, as browser security will prompt the user to allow their location to be sent, but this small snippet of information can tell you much more. Once you know someone’s location, you can assume it’s their home, business, or school, since these are the most likely places from which someone will be accessing the net. You can then use data about these places to work out who someone works for, or how much their income’s likely to be (based on where they can afford to live), giving an idea of that person’s status in society. For an idea of what info you can get from someone’s address, UK residents may like to try putting their postcode into this site: Home Check.
You can then wrap all this data in with a few cold reading general comments (there’s a great example in Derren Brown’s
Tricks of the Mind, of a few paragraphs which describe almost anyone between 20 and 40, but sound as if they’re aimed directly at the reader) to make the few bits of real data you’ve gathered have more impact.

Other potential sources of info.
PIPL. Search for people.
192. Another person search tool
Facebook. Details on how to read data from people’s facebook accounts (with their permission!).
Google Dashboard. Everything Google knows about you (if you have a google account).
What’s My IP. Details glean-able from your IP address.
. Information on what web browser you use (safari people are artistic, chrome are techie purists, opera like elegance, firefox like functionality, and IE people follow the status quo).
How long is a piece of string?. A book with a few examples of ways in which people have been conned by not understanding statistics. Slightly off topic, but an interesting read (my favourite is the football score predictor that gets the result right every time).

When you find out how much it’s possible to find out about yourself, you may get scared. However, most of this information is harmless for people to find out, and the stuff that isn’t you have protection from (privacy settings in applications such as Facebook, prompts before allowing features such as HTML5’s Geo). These features can be put to good use, for example by having a site which changes it’s style to match the user’s likely tastes, and to bring more relevant content to the front (such as Google searches bringing up local restaurants when you look for somewhere to eat).

2009-11-05

2009-11-04

Ideas for Wave Robots

Filed under: Google, Ideas, Technology, Wave — Tags: , , , , , , , , , , , — Developer42 @ 21:32

One of the hardest things about developing a wave robot is coming up with an original idea. My smiley bot [smiley_wave@appspot.com] was just for me to play with wave & get used to uploading apps to App Engine / get back into java coding and using eclipse. Now that that’s done, it’s time to think of something useful; an application that people will actually want to use. The point of this post is partly a brainstorming session for myself, and partly to put these ideas out there to anyone stuck for ideas, who think they can code one of these, and finally, to encourage others to submit ideas.

Webby – The Web Service Robot
A robot which when added, detects any URLs pointing to web services, generates a form based on the parameters, then submits this data via SOAP, and puts the return value into a new blip.

Squely – A Database Query Bot
A robot which can run SQL statements against given connection strings. At present, this will only be possible if the database is publicly accessible, or if you have a wave server installed on the same network as your database.

QIFry – Interesting
This robot would monitor waves for key words, then on detection, pop in an interesting fact about that word (e.g. if it spots the word Banana, it says “did you know that bananas are herbs, and these shrubs can walk?”). It also monitors for boring words, and replaces them with more eloquent ones.

Pretty – Pretty Print
Detects common languages / markup & changes the layout to make it more readable.

Recipe
Finds recipes based on ingredients or dish names in the wave.

FindMe
Uses the GEO features of HTML 5 to locate where each wave user is and lets wavers know where their nearest wavers are. This could also take info about their interests to help match people up to folks whose hobbies they share.

2009-11-03

My First Wave Robot :: smiley-wave@appspot.com

Filed under: Google, Technology, Wave — Tags: , , , , , , , — Developer42 @ 00:34

smiley-wave@appspot.com first demo

appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
	<application>smiley-wave</application>
	<version>1</version>
</appengine-web-app>

web.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
	<servlet>
		<servlet-name>Smiley</servlet-name>
		<servlet-class>inverso.google.wave.robot.smiley.SmileyServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>Smiley</servlet-name>
		<url-pattern>/_wave/robot/jsonrpc</url-pattern>
	</servlet-mapping>
</web-app>

capabilities.xml

<?xml version="1.0" encoding="utf-8"?>
<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">
  <w:capabilities>
    <w:capability name="blip_submitted" content="true" />
    <w:capability name="wavelet_self_added" content="true" />
  </w:capabilities>
  <w:version>1&lt/w:version>
</w:robot>

SmileyServlet.java

package inverso.google.wave.robot.smiley;
import com.google.wave.api.*;
import java.util.*;
		
//FIX FOR ISSUE 354 is used where the robot suffers from the bug mentioned in the below links
//http://code.google.com/p/google-wave-resources/issues/detail?id=373
//http://code.google.com/p/google-wave-resources/issues/detail?id=354
		
public class SmileyServlet extends AbstractRobotServlet {
		
       /**
	 * Robot's version id & usage info
	 */
	private static final long serialVersionUID = 1L;
	private static final long serialSubVersionUID = 2L; //this is to help me prove that my latest changes 
                                                            //have been uploaded correctly
	private static final String serialVersionID = "Version #" + new Long(serialVersionUID).toString() + "." + 
                                                      new Long(serialSubVersionUID).toString();
	private static final String helpInfo = "\nThis robot is my learning tool for wave development, " +
                                               "so may occasionally break!  Apologies if you're one of " +
                                               "the people for whom it doesn't work!";
	private static HashMap dictionary = null;
		
	/*
	 * Creates the images & registers them against their invoking smileys 
	 * */	
	static {
		final int width = 24;
		final int height = 24;
		//http://commons.wikimedia.org/wiki/Smiley
		dictionary = new HashMap();
		dictionary.put(":)",new Image("http://upload.wikimedia.org/wikipedia/commons/7/79/Face-smile.svg",width,height,":)"));
		dictionary.put(":(",new Image("http://upload.wikimedia.org/wikipedia/commons/0/06/Face-sad.svg",width,height,":("));
		dictionary.put(";)",new Image("http://upload.wikimedia.org/wikipedia/commons/5/57/Face-wink.svg",width,height,";)"));
		dictionary.put(":D",new Image("http://upload.wikimedia.org/wikipedia/commons/1/15/Face-smile-big.svg",width,height,":D"));
	}
	
   /**
     * Handles changes to the wave 
     **/
	@Override 
	public void processEvents(RobotMessageBundle bundle) {		
		
		if (bundle.wasSelfAdded()) {
			final Blip blip = bundle.getWavelet().appendBlip();
			blip.getDocument().delete(); //FIX FOR ISSUE 354
			final TextView textView = blip.getDocument();
			textView.append( serialVersionID );
			textView.append( helpInfo );
		}
		
		for (Event e: bundle.getEvents()) {
			if ((e.getType() == EventType.BLIP_SUBMITTED) || (e.getType() == EventType.WAVELET_SELF_ADDED)) {
				final Blip blip = e.getBlip();
				smile(blip.getDocument());
			}
		}
	    
	}
	
	private void smile(TextView textView){
		final String text = textView.getText();
		Iterator<Map.Entry> i = dictionary.entrySet().iterator();
		while(i.hasNext()){
			Map.Entry pic = i.next();
			String key = pic.getKey();
			int pos = -1;
			while((pos = text.indexOf(key,++pos))>-1){
				textView.delete(new Range(pos, pos + key.length()));
				textView.insertElement(pos,pic.getValue());
			}
		}	
	}
		
}

Create a free website or blog at WordPress.com.

%d bloggers like this: