Archive

Archive for September, 2007

A Silverlight Project Template

September 29th, 2007 Mick Comments off

A full description of what you need to do to add Silverlight to a web page is described in the Silverlight QuickStart Guide at

http://silverlight.net/quickstarts/silverlight10/FileSetup.aspx

I used the default Silverlight Project item in Visual Studio (Visual Studio 2008 beta 2 and Silverlight 1.1 Alpha Refresh) to generate the following example files which I’m calling a Silverlight Template.

Silverlight Template Files

TestPage.html is the main entry point for the web page.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" >
  3. <!– saved from url=(0014)about:internet –>
  4.     <title>Silverlight Project Test Page </title>
  5.  
  6.     <script type="text/javascript" src="Silverlight.js"></script>
  7.     <script type="text/javascript" src="TestPage.html.js"></script>
  8.     <style type="text/css">
  9.         .silverlightHost { width: 640px; height: 480px; }
  10.     </style>
  11. </head>
  12.  
  13.     <div id="SilverlightControlHost" class="silverlightHost" >
  14.         <script type="text/javascript">
  15.             createSilverlight();
  16.         </script>
  17.     </div>
  18. </body>
  19. </html>

It references Silverlight.js and TestPage.html.js and embeds the Silverlight control on the page.

Silverlight.js is a Javascript helper file that enables Silverlight content to be viewed on multiple platforms and handles everything from checking if the correct version of Silverlight is installed to ensuring that the control is inserted correctly. It is available from the Silverlight Software Development Kit (SDK) and copied into the project location when using Visual Studio.

TestPage.html.js is an auto-generated Javascript file which contains the function createSilverlight.

  1. // JScript source code
  2.  
  3. //contains calls to silverlight.js, example below loads Page.xaml
  4. function createSilverlight()
  5. {
  6.         Silverlight.createObjectEx({
  7.                 source: "Page.xaml",
  8.                 parentElement: document.getElementById("SilverlightControlHost"),
  9.                 id: "SilverlightControl",
  10.                 properties: {
  11.                         width: "100%",
  12.                         height: "100%",
  13.                         version: "1.1",
  14.                         enableHtmlAccess: "true"
  15.                 },
  16.                 events: {}
  17.         });
  18.  
  19.         // Give the keyboard focus to the Silverlight control by default
  20.     document.body.onload = function() {
  21.       var silverlightControl = document.getElementById(‘SilverlightControl’);
  22.       if (silverlightControl)
  23.       silverlightControl.focus();
  24.     }
  25.  
  26. }

The createSilverlight method is called to insert the Silverlight control onto the web page. If you want to insert more than one Silverlight control onto a web page there are instructions in the Silverlight QuickStart guide mentioned above or there is another approach described at

http://blog.paranoidferret.com/index.php/…/how-to-embed-silverlight-into-a-webpage/

And last, but not least, we have the XAML file which describes the content of the Silverlight control

  1. <canvas x:Name="parentCanvas"
  2.        xmlns="http://schemas.microsoft.com/client/2007"
  3.        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.        Loaded="Page_Loaded"
  5.        x:Class="Silverlight_Template.Page;assembly=ClientBin/Silverlight_Template.dll"
  6.        Width="640"
  7.        Height="480"
  8.        Background="Black"
  9.        >
  10. </canvas>

This sample is using C# for the code behind so there is an associated DLL (created by building the project) which is located in the ClientBin sub-directory (relative the the HTML file not the XAML file).

Categories: Silverlight Tags:

Amazon MP3

September 27th, 2007 Mick Comments off

Noticed that Amazon have recently launched their own music downloading service, to compete with iTunes from Apple.

http://amazon.com/gp/dmusic/…

Will Amazon succeed when companies like Virgin Digital recently decided to close their doors?

The Virgin Digital site will finally close on October 19 see more detail at

http://www.virgindigital.co.uk

The point of note, with the new Amazon venture, is the fact that music tracks which they have available (more than 2 million songs) are completely free of any Digital Rights Management (DRM) control.

DRM is a digital padlock which is used to prevent copying of the downloaded material and can also be used to ensure that the material can only be played on a specific device.

Music which is free of DRM makes it more appealing to a wider audience and with the backing of a large company such as Amazon, which can ensure competitive prices versus iTunes, looks certain to be a success.

However, the price per track still seems on the high side to me even at a rate of the quoted $0.89 – $0.99 per track. Why not retail at $0.50 ?

Categories: General, News Tags:

ShakeIT

September 26th, 2007 Mick Comments off

I was interested to come across this media player, from PASEN which can be shaken (but not stirred), to shuffle through pictures, music and menu items.

In addition to the usual features expected in todays media player devices, the ShakeIT uses a motion sensor that detects the “shake” that allows you to select menu items etc..

I’m not sure whether this would work well while jogging, so perhaps this is why it can also be used as a pedometer which will incorporate a program to calculate the distance you’ve travelled and how many calories you’ve used.

All the details at

http://en.pasen.it/news.php

It started me wondering what would be the most innovative use for a motion sensor or acclerometer device?

Categories: Accelerometer, User Interface Tags:

A Minimal Plugin for WordPress

September 22nd, 2007 Mick 1 comment

I recently found a need to access data held in a WordPress database. Although I could have written code that accessed the database directly, I decided to write a plugin so that I could use the in-built WordPress functions.

Writing a WordPress plugin is fairly straightforward and I would recommend reading information provided at wordpress.org for writing plugins

http://codex.wordpress.org/Writing_a_Plugin
http://codex.wordpress.org/Function_Reference

However, if it’s of any interest, here are my efforts at creating a minimal plugin. A minimal plugin is presented which can be re-used, essentially as a starting point, for creating various different plugins, and is the minimum structure required when creating a plugin for WordPress.

I created a file, called minimal_plugin.php, containing the following code and placed it in my wordpress plugins directory. (wordpress/wp-content/plugins). The plugin, called Minimal Plugin is then available in the list of plugins:

Minimal Plugin

When this plugin is activated, a menu item Minimal Plugin is added to the WordPress Dashboard:

Dashboard

The code consists of 2 functions

function minimal_addMenu() is used to add a menu item and is called by

  1. add_action(‘admin_menu’, ‘minimal_addMenu’);

which adds the menu item to the dashboard admin page.

function minimal_adminMenu() defines what is displayed on the page under the Minimal Plugin tab. This can also used to call available internal WordPress functions that allow you to access details available in the database.

In addition, information is used from the comments section

  1. /*
  2. Plugin Name: Minimal Plugin
  3. Plugin URI: http://somewhere/
  4. Description: Minimal Plugin
  5. Author: Minimal
  6. Version: 0.0.1
  7. Author URI: http://somewhere/
  8. */

Here is the complete code listing

  1. <?php
  2. /*
  3. Plugin Name: Minimal Plugin
  4. Plugin URI: http://somewhere/
  5. Description: Minimal Plugin
  6. Author: Minimal
  7. Version: 0.0.1
  8. Author URI: http://somewhere/
  9.  
  10. Last update: 09/20/07 (09/20/07)
  11.  
  12. Functions:
  13. minimal_adminMenu: where all the work is done
  14.  
  15. Copyright 2006-2007 Minimal
  16.  
  17.     This program is free software; you can redistribute it and/or modify
  18.     it under the terms of the GNU General Public License as published by
  19.     the Free Software Foundation; either version 2 of the License, or
  20.     (at your option) any later version.
  21.  
  22.     This program is distributed in the hope that it will be useful,
  23.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  24.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  25.     GNU General Public License for more details.
  26.  
  27.     You should have received a copy of the GNU General Public License
  28.     along with this program; if not, write to the Free Software
  29.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  30. */
  31. $minimal_version = ‘v0.0.1′; // the current version
  32.  
  33. // more details at …
  34. // http://codex.wordpress.org/Writing_a_Plugin
  35. // http://codex.wordpress.org/Function_Reference
  36.  
  37.  
  38. function minimal_addMenu()
  39. {
  40.         if ( function_exists(‘add_submenu_page’) )
  41.         {
  42.                 add_submenu_page(‘index.php’, ‘Minimal Plugin Template’, ‘Minimal Plugin’, 1, basename(__FILE__),‘minimal_adminMenu’);
  43.         }
  44. }
  45.  
  46. function minimal_adminMenu()
  47. {
  48. global $minimal_version;
  49.         echo(‘<div class="wrap">’);
  50.         echo("<h2>Minimal Plugin – version $minimal_version</h2><br /><br />");
  51.         echo(‘</div>’);
  52. }
  53.  
  54. add_action(‘admin_menu’, ‘minimal_addMenu’);
  55.  
  56. ?>
Categories: Wordpress Tags:

Windows Live ID – Web Authentication

September 19th, 2007 Mick Comments off

The Windows Live ID Service is the identity and authentication mechanism provided by Windows Live. Currently there are over 380,000,000 users that have Windows Live ID credentials.

Mentioned during a session at the recent MixUK, the Windows Live ID Web Authentication 1.0 SDK provides an easy-to-use authentication system that allows that allows the Windows Live ID service to verify the identity of visitors to a Web site. One advantage of this approach is that a user doesn’t have to use separate login mechanisms for each site that they visit.

Windows Live ID provides you with a unique, site-specific identifier for each Windows Live user who signs in to your site. Web Authentication also enables you to incorporate Windows Live controls into your site.

Web Authentication works by sending your users to the Windows Live ID sign-in page by means of a specially formatted link. The service then directs them back to your Web site along with a unique, site-specific identifier that you can use to manage personalized content, assign user rights, and perform other tasks for the authenticated user.

Sign-in and account management is performed by Windows Live ID, so you don’t have to worry about implementing these details. Windows Live ID profile data is not shared with your site.

Full details about the Windows Live ID SDK is available from the Microsoft MSDN web-site at:

http://msdn2.microsoft.com/en-us/library/bb404787.aspx

In general, the tasks required when implementing Web Authentication include:

  • Register the application
  • Display the Sign In link on the web-page
  • Decrypt the token returned by Window Live ID to obtain the users unique identifier
  • Manage personalized content and settings for your user, based on the site’s security policies
  • Sign the user out

The best place to start is by obtaining one of the sample applications which are provided in a number of different languages including:

  • ASP.NET (c#)
  • Java
  • Perl
  • PHP
  • Python
  • Ruby

These samples can be obtained from:

http://msdn2.microsoft.com/en-us/library/bb676635.aspx

and here’s the python sample in action …

Python Sample

In addition to making sure I had the correct version of python (2.5) installed on my server !! I found it necessary to install the Python Cryptography Toolkit which I obtained from

http://www.voidspace.org.uk/python/modules.shtml#pycrypto

To implement Windows Live ID, you must register your Web site with Microsoft® as an application and receive an application ID for use with the service.

This is straightforward to do from the Windows Live ID Application page at

https://msm.live.com/app/default.aspx

Get an Application ID

You need to enter the following details

The application name is a unique and friendly name that you use to refer to your application.

The return URL is the URL of the page on your Web site to which the Windows Live ID authentication service redirects users (along with the authentication token) after they have successfully signed in, signed out, or cleared their cookies. You must create a page on your site corresponding to the return URL, to handle the response from the authentication service

The secret key is a shared secret between you and Windows Live ID. Windows Live ID uses this key to encrypt and sign all tokens that it sends to your site. You should choose a secret key that is difficult to guess and create security procedures to manage this key.

and you’re all set – the application ID you get is a 16-character string that represents your application which you’ll use later.

To test out the system, I simply extended the python sample to run from a web-site (which I specified when registering the application) and needed to change the Application-Key.xml file which was supplied as part of the python sample, with details of my registered application.

In summary, I found it quick and easy to set up a simple test application using the Window Live ID Web authentication process which I can use in the future across my collection of web-sites as a single mechanism for user authentication.

As mentioned earlier in-depth information is available directly from Microsoft at

http://msdn2.microsoft.com/en-us/library/bb676635.aspx

Categories: Web, Windows Live Tags:

iPhone available in the UK – Nov 9

September 19th, 2007 Mick Comments off

If you’ve not heard about it already, the new iPhone from Apple will be available in the UK from Nov 9.

iPhone

With the iPhone, you make a call by simply tapping on a name or number in your address book, using only your fingers on the currently unique multi-touch display.

The embedded technology also incorporates an accelerometer device which is used to determine when you rotate the iPhone from a portrait to landscape orientation so that the display changes automatically.

Other technology includes a proximity sensor which switches off the display when you move the phone towards your ear – this also prevents accidental touches on the screen. An ambient light sensor is used to automatically adjust the brightness of the display to tha appropriate level.

Read all about the iPhone from the Apple web-site:

http://www.apple.com/uk/iphone/phone/

The phone, at a price of £269 ($536) for the 8Gb version, will be available in the UK using mobile operator O2.

O2 contracts will range from £35-£55 per month which will include unlimited use of a wi-fi network from more than 7500 hot spots. Thus, for an 18 month contract, this will cost a minimum of £900 (including the cost of the phone and local taxes).

Read about the O2 side of the deal at the O2 web-site

http://tinyurl.com/yql653

Categories: Apple, Gadgets Tags:

Wacom – the next 25 years

September 19th, 2007 Mick Comments off

As Wacom, the developer of pen-tablet devices and related technology, celebrates its Silver Anniversary it has recently announced a new direction for the future.

Wacom recently announced its new brand concept for the next stage in its growth, building on the vision which has inspired it to create tools that have put high technology into the hands of the world’s most creative people in the simplest and most natural way. This new direction clearly sets out the company’s ambition for continued growth beyond the pen technology it has become famous for. It sets the way ahead for further innovations for anyone who uses interface technology. The announcement of the growth vision has been accompanied by a transformation of the company’s corporate identity and the introduction of a new consumer brand.

Read the full press release at


http://www.wacom-europe.com/uk/press/….id=233&prlanguage=uk#

and visit the re-designed Wacom web-site at

http://www.wacom.com/

Although this could just be seen as simply a re-branding exercise, Wacom introduces the Bamboo range that looks to introduce its suite of pen tablets for navigating, drawing, painting, writing and retouching photographs on a computer, to a home user where previously its product range had been aimed at the creative professional.

Read about the Bamboo range at

http://www.wacom.com/wacombamboo/

or in Europe at


http://www.wacom-europe.com/bamboo/

now if only they would reduce the price of the Cintiq …

Categories: Input Devices, News Tags:

Google Presentation

September 19th, 2007 Mick Comments off

Google provides the ability to create business presentations using a recent addition to its office software suite.

In addition to Documents and Spreadsheets there is now an option to create a Presentation.

Presentation

The functionality provided is sufficient to create reasonable presentation material but without all the bells and whistles offered by the current version of Microsoft Powerpoint.

As with the other document types within the suite, multiple users can access and contribute to the creation of the presentation. When complete, the presentation can be published and made accessible to anyone with a web browser.

You can watch the following video which describes ideas behind the Google Documents concept

To find out more, visit the home page at

http://documents.google.com

Categories: Google Tags: