Google, JavaScript

Google MiniMessage… now anywhere you need it

One of the things you notice quickly when building gadgets for the Google Apps Platform is that there are significant inconsistencies between the different environments, the API’s available and the way they needs to be configured and deployed… some of the time the differences are more or less logic and self-explanatory, however in other cases it’s difficult to make sense from it… and its made even less logic when it comes to the lack of proper documentation which in some cases is erroneous or at best, entirely absent… one of those cases is the availability of the MiniMessage API

…since it’s not available in the Gmail Contextual Gadget environment, I decided to implement it myself with the same interface as the Google implementation so the code wouldn’t have to undergo a lot of change when switched between different environments…

MiniMessage = function( container ) {

	this.messages = $( "<ul></ul>" );
	this.messages.addClass( "miniMessage" );

	this.container = container != null ? container : $( document.body );
	this.container.append( this.messages );
};

MiniMessage.prototype.container = null;
MiniMessage.prototype.messages = null;

MiniMessage.prototype.dismissMessage = function( message ) {

	try {
		$( message ).remove();
	}
	catch( Error ) {
		// ignore
	}
};

MiniMessage.prototype.createMessage = function( message ) {

	var messageElement = $( "<li>"+ message.toString() +"</li>" );
	messageElement.addClass( "miniMessageItem" );
	this.messages.append( messageElement );
	return messageElement;
};

MiniMessage.prototype.createStaticMessage = function( message ) {

	return this.createMessage( message );
};

MiniMessage.prototype.createTimerMessage = function( message, seconds, callback ) {

	var messageElement = this.createMessage( message );

	var me = this;
	var dismissMessageFn = function() {
			me.dismissMessage( messageElement );
			callback.call( me, messageElement );
		};
	window.setTimeout( dismissMessageFn, seconds * 1000 )

	return messageElement
};

MiniMessage.prototype.createDismissableMessage = function( message ) {

	var message = this.createMessage( message );
	message.click( this.messageClickHandler.bind( this ) );
};

MiniMessage.prototype.messageClickHandler = function( event ) {
	this.dismissMessage( event.target )
};

Since basically every JavaScript project I do in some way or another uses jQuery, I opted to allow dependency on this, however should it be necessary to omit the use of jQuery (which is only used for DOM manipulation anyways), it would to change the constructor to use native DOM management functions…

Eclipse, Google, Google App Engine

Getting Started with Google Plugin for Eclipse

Recently I have come across a project where we have to use Google App Engine, for this purpose we decided to take the Google Plugin for Eclipse for a spin.

Moving along the tracks of getting started, its bound not to be entirely frictionless, however first trouble came immediately after installing.

I’m running a MAC OSX 10.7.2 on a MBP, using Eclipse IDE for JavaScript Web Developers including the Java Development Capabilities in the Indigo Service Release 1 version.

Immediately after installing the Google Plugin and continued to the next step to Create my First Web Application Project for the Google App Engine, I ran into problems with the Lack of JRE mappings in the IDE.

Specifically the error was the following:

Unable to locate the JVM for project XXX
Please verify that you have a project-level JVM installed by inspecting your project’s build path.

But there is no need to panic, just go to through the following few steps…

  1. Open Preferences for Eclipse on the File Menu.
  2. Navigate to “Java” –> “Installed JRE’s”
  3. If the list is empty, which I assume it is since you are reading this page just now, just click “Add”.
  4. Select “Standard VM”
  5. For JRE Home, navigate to and select the following path:
    /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  6. Enter a name like JRE 1.6.0
  7. Leave Default Arguments empty
  8. Click Finish.
  9. Close Preferences.

 

Likely you should see the project compiling now…

 

So, selecting “Debug As… Web Application” will start the build-in server up listening on port 8888,  and in the console of your Eclipse you should see the last listing being this one…
INFO: The admin console is running at http://localhost:8888/_ah/admin

Navigate to that URL and you should see this rudimentary but functional administration console…

Good luck with using the App Engine…

Adobe, Flash Platform, Google

Adobe and Google Partnering for Flash Player on Linux

Adobe has been working closely with Google to develop a single modern API for hosting plugins within the browser (one which could replace the current Netscape plugin API being used by the Flash Player). The PPAPI, code-named “Pepper” aims to provide a layer between the plugin and browser that abstracts away differences between browser and operating system implementations.

This is GREAT news for Flash and Flex folks out there, ever since Adobe decided to discontinue their effort to support Air for Linux in favor of focusing more on Android, its always been a thorn in the foot regarding Linux support…

Check it out…
http://blogs.adobe.com/flashplayer/2012/02/adobe-and-google-partnering-for-flash-player-on-linux.html