Archive

Archive for September, 2009

Handwriting recognition

Just got a Wacom tablet at the weekend, and then started looking for some practical application….
Not quite practical, but I was presently surprised with some Handwriting recognition by
ritePen.

I tried getting Microsoft INK to work, but I think it requires a tablet PC.

Categories: Uncategorized

Using Webservices with Flex

I was working on a larger Flex example this morning: Sending SMS via a webservice in Flex
But due to the Flash sandbox, there is a hurdle you have to jump, security wise, to access a webservice from Flash,
and it first shows it’s ugly head with this exception:

[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://www.freebiesms.co.uk/sendSMS.asmx?wsdl)"%5D
    at mx.rpc.wsdl::WSDLLoader/faultHandler()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcwsdlWSDLLoader.as:98]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcAbstractInvoker.as:170]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcAbstractInvoker.as:225]
    at mx.rpc::Responder/fault()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcResponder.as:53]
    at mx.rpc::AsyncRequest/fault()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcAsyncRequest.as:103]
    at DirectHTTPMessageResponder/securityErrorHandler()[C:autobuild3.2.0frameworksprojectsrpcsrcmxmessagingchannelsDirectHTTPChannel.as:389]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/redirectEvent()

Which, after hunting on the Net, showed me that I needed a crossdomain.xml file thus:

<cross-domain-policy>
    <allow-access-from domain="*"/>
    <allow-http-request-headers-from domain="*" headers="SOAPAction"/>
</cross-domain-policy>

– Oh, and I also found out that Webservice method names are case-sensitive, when I got this error:

[RPC Fault faultString="Couldn’t find method ‘sendSms’ in service." faultCode="Client.NoSuchMethod" faultDetail="null"]
    at mx.rpc.soap::Operation/createFaultEvent()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcsoapOperation.as:978]
    at mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcsoapOperation.as:763]
    at mx.rpc.soap::Operation/send()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcsoapOperation.as:693]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.rpc.soap.mxml::Operation/send()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcsoapmxmlOperation.as:170]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()[C:autobuild3.2.0frameworksprojectsrpcsrcmxrpcAbstractService.as:290]
    at FreebieSMS/click()[C:Documents and SettingsAdminMy DocumentsVisual Studio 2008ProjectsFreebieSMSFlexFreebieSMSFlexsrcFreebieSMS.as:31]
    at FreebieSMSFlex/___FreebieSMSFlex_Button1_click()[C:Documents and SettingsAdminMy DocumentsVisual Studio 2008ProjectsFreebieSMSFlexFreebieSMSFlexsrcFreebieSMSFlex.mxml:4]

Categories: Uncategorized

Using Code-behind with Flex

This is a few steps on how to use Code-behind with Flex & Visual Studio 2008.

Installed Ensemble Tofino  (With SDK)

This was my MXML file:

<?xml version="1.0" encoding="utf-8" ?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml&quot;
    layout="absolute">   
    <mx:Button x="45" y="33" label="Say Hello!" click="HelloWorld.click(event)"/>   
</mx:Application>

And the .AS file was:

package
{
    import flash.events.Event;
    import flash.events.MouseEvent;
    import mx.controls.Alert;
   
    public class HelloWorld
    {
        public static function click(event:MouseEvent)
        {
            Alert.show("This responded to an event from code-behind");
        }
    }
}

Ideally, The Application Class should inherit from HelloWorld, so that the click event could be protected rather than
static; so it should be modified as follows:

<?xml version="1.0" encoding="utf-8" ?>
<my:HelloWorld xmlns:my="*"
    xmlns:mx="http://www.adobe.com/2006/mxml&quot;
    layout="absolute">   
    <mx:Button x="45" y="33" label="Say Hello!" click="click(event)"/>   
</my:HelloWorld>

and the AS file thus:

package
{
    import flash.events.Event;
    import flash.events.MouseEvent;
    import mx.controls.Alert;
    import mx.core.Application;
   
    public class HelloWorld extends Application
    {
        protected function click(event:MouseEvent)
        {
            Alert.show("This responded to an event from code-behind");
        }
    }
}

Categories: Uncategorized

Facebook App development

Freebie SMS Facebook App

Download link: Download Facebook App with source code in C#
Facebook link: Free SMS Facebook App

This is a Facebook App for sending free SMS messages to UK mobile phones,
It was created with the asp.net starter kit for C# 3.5. and can be downloaded from the links above
with full source code.

The only real departure from a standard asp.net page, is that it gets the ‘from name’ from the Facebook profile, like this:
      
       protected string GetUserName()
        {
            try
            {
                facebook.Schema.user userinfo = Master.API.users.getInfo(Master.API.uid);
                return userinfo.first_name;
            }
            catch
            {
                return "Someone";
            }
        }

Note, that the exception can be thrown on first load, before the user has accepted access to their own profile, hense
the try/catch

Categories: Uncategorized

Setting up SQL server Azure

This is my experience with setting up SQL server Azure (2008), pretty difficult, and very buggy, to be honest,
my feeling is to stay away from the CTP, but here’s my ‘walkthrough’

I got this email a few days ago:

Welcome to the SQL Azure CTP!  We are excited to have you join us.  Below are
some steps to get you started, as well as links to helpful resources. 

 

 Getting Started

1)     Visit https://sql.azure.com

2)     Sign in with a valid Windows LiveID

3)     Enter your invitation code

 Your invitation code is:
d329171f-c1fd-4060-862e-1a7f613ea8ce

 4)     Create your SQL Azure Server (and
databases)

 So I stepped through the process, and set up an Azure database, then I found that I needed SQL server 2008 to connect to it,

I downloaded  SQLManagementStudio_x86_ENU.exe from
http://www.microsoft.com/DownLoads/details.aspx?familyid=08E52AC2-1D62-45F6-9A4A-4B76A8564A2B&displaylang=en

During Install, said that I needed to reboot… when I had, so a work around was:

# Open Regedit
# Find the key "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession Manager"
# Rename the "PendingFileRenameOperations" value to "PendingFileRenameOperations2"
# Re-Run the checks

Downloaded powershell:

http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=6ccb7e0d-8f1d-4b97-a397-47bcc8ba3806&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f7%2f3%2f4%2f7345bb7d-0b07-40e8-9480-5b8c55b9c8b7%2fWindowsXP-KB926139-v2-x86-ENU.exe

Uninstalled SQL server management studio express

Uninstalled Visual studio 2008

It then crashed with this error:

TITLE: SQL Server Setup failure.
——————————

SQL Server Setup has encountered the following error:

Unable to generate a temporary class (result=1).
error CS0006: Metadata file ‘C:WINDOWSassemblyGAC_MSILMSClusterLib1.0.0.0__89845dcd8080cc91MSClusterLib.dll’ could not be found

Error code 0x84B10001.

——————————
BUTTONS:

OK
——————————

Rebooted…

Deleted the PendingFileOperations Registry Key

Installed!

Tried to Connect:

ADO.NET:
Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=master;User ID=fiach;Password=myPassword;Trusted_Connection=False; Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=;User ID=fiach;Password=myPassword;Trusted_Connection=False; Copy to clipboard
ODBC:
Driver={SQL Server};Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=master;Uid=fiach;Pwd=myPassword; Driver={SQL Server};Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=;Uid=fiach;Pwd=myPassword; Copy to clipboard
OLE DB:
Provider=SQLNCLI10;Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=master;Uid=fiach;Pwd=myPasswor

TITLE: Connect to Server
——————————

Cannot connect to yitwxb6n0v.ctp.database.windows.net.

——————————
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

——————————

Invalid object name ‘sys.configurations’. (Microsoft SQL Server, Error: 208)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.9006&EvtSrc=MSSQLServer&EvtID=208&LinkId=20476

——————————
BUTTONS:

OK
——————————

Fixed using this post:

http://social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/9e5b6854-9e5a-4e7d-b771-313aa5683b72

1. cancel out of the first connection dialog that pops up.
2. click on the New Query button from the toolbar (upper left)
3. entered
       Server name: full servername
       Login: just the username (no @…)
4. Under Options, Connect to Database, (type your database here)
5. Hit connect.

And I got in… after an hour.

Now to figure out how to copy the databases!

Categories: Uncategorized