All Change

by Neil Middleton 3:59 pm Monday, 13 July 2009.

Life keeps getting more and more exciting for the Monochrome team, it’s been and continues to be a hive of activity, we’ve seen an increase in the demand for rich internet applications across varying technologies, five flex apps, 3 currently in production and on our 3rd deployment of Silverlight, we’re excited to see what else is in store for our Epsom office. We’ve also joined the Adobe Web Agency Partner programme and have 2 ACE members (Adobe Community Experts) to support this relationship.

As we go through a major refresh of blogs and news items, not to mention our new website we go into the next qtr with lots and lots to talk about. We’d like to welcome 3 new members to the Monochrome team, Al Pennell-Smith - XHTML/CSS specialist, Clay Thompson - Senior Creative for UX and Kardo Ayoub - UX Specialist, all adding great value to the business and our customers.
Someone you’ll be hearing a lot more from over the next few months is our Business Manager Matt Glavin supporting myself Adrian Munn with the increased RIA workload. Our core technology partnerships have enabled our business to grow significantly over the past 12 months - Matt has undertaken the role of managing these alliances and forging new relationships with the support of the sales team.

In times of recession it’s clear to Monochrome through communications with customers that businesses are re-evaluating how to achieve the most from their current applications delivering fast ROI through current business processes.

We have changed our business model and adapted the way in which we deliver services to customers by removing the technical jargon and replacing it with proven methods for delivering applications in a fast and cost effective approach.


Comments (0)



XMLSocket.send / Socket.writeUTFBytes doesn’t work?

by Radek Gruchalski 2:51 pm Thursday, 11 June 2009.

Disclamer
In first words - no, of course it is not broken, it is working fine. But there is a specific issue with these two methods that when the socket server is implemented incorrectly and people may look for the solution using what’s in the title.

I just finished writing an ActionScript 3 SWC library which is going to be used with Flex and Flash applications. The library uses Socket connection to provide some statistical information to the Java socket server. As part of the project I had to create simple socket server which simply writes what it gets to the standard output.

The code was working fine when running in Flex Builder debugger. However, as soon as I started the test application in the Flash IDE I found following problem:

  • SWF was requesting policy file
  • my Java socket server was serving policy file
  • SWF was showing that it was connected
  • any other messages sent to the socket were not coming through

Exactly the same problem appeared when I deployed Flex version on the external server. It worked while running in the debugger but not from the browser. So it was clearly something wrong with the socket server. Once the policy file was served any other communication wasn’t working. My socket server looked like this:

package uk.co.test;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class SocketTest {
 public static void main(String[] args) throws Exception {
  System.out.println("Starting...");
  start();
 }
 public static void start() throws Exception {
  // create socket server
  ServerSocket ss = new ServerSocket(1234);
  for (;;) {

   System.out.println("Waiting for the client.");
   Socket cs = ss.accept();
   System.out.println("Connection...");

   InputStream in = cs.getInputStream();
   OutputStream out = cs.getOutputStream();
   boolean isConnected = true;
   StringBuffer soFar = new StringBuffer();
   byte b;

   while (isConnected) {
    // let it rest a bit:
    Thread.sleep(10);
    // read everything what's coming in:
    while ( (b = (byte)in.read()) > -1 ) {
     if ( b == 0 ) {
      // zero byte, process:
      String value = soFar.toString();
      // get the value
      if ( value.equals("<policy-file-request/>") ) {
       // policy file requested, sent the policy back:
       System.out.println("Policy file request.");
       String crossdomain = "<?xml version=\"1.0\"?>";
       crossdomain += "<cross-domain-policy>";
       crossdomain += "<allow-access-from domain=\"*\" to-ports=\"*\" secure=\"false\" />";
       crossdomain += "</cross-domain-policy>";
       out.write(crossdomain.getBytes());
       out.write((byte)0);
       out.flush();
       System.out.println("Policy file sent.");

      } else {

       if ( value.equals("exit") ) {
        // if exit command received, finish:
        isConnected = false;
       } else {
        // just output the message:
        System.out.println(value);
       }

      }
      soFar.setLength(0);
     } else {
      // append the character to the buffer:
      byte[] buf = new byte[1];
      buf[0] = b;
      soFar.append( new String(buf) );
     }
    }
   }
  }
 }
}

While looking for the solution I found the following article: Setting up a socket policy file server. Peleus Uhley from Adobe describes how to use policy files effectively. In What data is sent in the request and response? section of the article there is a solution..

Once Flash Player receives the socket policy file, it closes the connection and opens a new connection if the policy file approves the request.

Looking at the above socket server code I could now clearly see what’s wrong. Once the connection is accepted no other connections are coming in until the first client sends exit message. So I modified my socket server, here it is:

SocketTest.java

package uk.co.test;

import java.net.ServerSocket;
import java.net.Socket;

public class SocketTest {

 public static void main(String[] args) throws Exception {
  System.out.println("Starting...");
  start();
 }

 public static void start() throws Exception {
  // create socket:
  ServerSocket ss = new ServerSocket(1234);
  for (;;) {
   System.out.println("Waiting for the client.");
   Socket cs = ss.accept();
   System.out.println("Connection...");
   // create socket connection handler and run it in separate thread:
   new SocketHandler(cs);
  }
 }
}

SocketHandler.java

package uk.co.test;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class SocketHandler
implements Runnable {

 private Socket _client;

 public SocketHandler(Socket s) {
  _client = s;
  // create new thread from this instance and start it:
  Thread t = new Thread(this);
  t.start();
 }

 public void run() {
  try {
   // get client in/out:
   InputStream in = _client.getInputStream();
   OutputStream out = _client.getOutputStream();
   boolean isConnected = true;
   StringBuffer soFar = new StringBuffer();
   byte b;

   while (isConnected) {
    // let it rest a bit:
    Thread.sleep(10);
    // read everything coming in:
    while ( (b = (byte)in.read()) > -1 ) {
     if ( b == 0 ) {
      // zero byte, process what already came in:
      String value = soFar.toString();
      if ( value.equals("<policy-file-request/>") ) {
       // policy file requested, send it to the client:
       System.out.println("Policy file request.");
       String crossdomain = "<?xml version=\"1.0\"?>";
       crossdomain += "<cross-domain-policy>";
       crossdomain += "<allow-access-from domain=\"*\" to-ports=\"*\" secure=\"false\" />";
       crossdomain += "</cross-domain-policy>";
       out.write(crossdomain.getBytes());
       out.write((byte)0);
       out.flush();
       System.out.println("Policy file sent.");

      } else {

       if ( value.equals("exit") ) {
        // exit command received, exit then...
        isConnected = false;
       } else {
        // just print the message to the stdout:
        System.out.println(value);
       }

      }
      soFar.setLength(0);
     } else {
      // append the char to the buffer:
      byte[] buf = new byte[1];
      buf[0] = b;
      soFar.append( new String(buf) );
     }
    }
   }
  } catch (Exception e) {
   // ignore
  }
 }
}

The second socket server fixed the problem. It is working for connections with and without policy requests, from Flash IDE, Flex Builder and the browser.

It took me 5 hours to figure out the solution (process client connections in separate threads) so if you’re in the same situation as I was I hope this post helps you.

Comments (3)



Communication Nation

by Adrian Bridgwater 5:59 pm Friday, 8 May 2009.

I’d like to kick off this first blog in my new editorial content role at Monochrome Limited with a reference to the way we approach editorial content as part of the web design and development process.

Clear and concise communication can seem like a hard thing to achieve in this age of email overload, social networking and general web-driven chatter. For this reason, as an agency we will remain focused on the need to be punctual, precise and provocative at all times.

We want to make sure that our editorial content is as compelling as the dynamic graphical elements of the Rich Internet Applications that we build and we will not settle for a second rate job at any level.

You’ll be hearing a lot more from us in the future, these are exciting times for the web and we want to take you with us on a fascinating journey.

Comments (0)



The Bentaur hits London

by Neil Middleton 12:19 am Thursday, 23 April 2009.

On Tuesday night the UKCFUG had the pleasure of Ben Forta, Mr Evangelism at Adobe, coming over to give us all a run-down on the latest news in the ColdFusion world, and what’s up and coming in the long awaited next version of ColdFusion, Centaur (or 9 as it will more likely be known).

After a late-in-the-day, but necessary change of venue we had 140+ ColdFusion developers descending on the Sway Bar in Holborn, London (also the future venue of the London leg of “Scotch-on-the-Road“). From mine and Nik’s memory we reckon this places this single meeting in the top three in terms of attendance (and that’s a history going back around a decade). This goes to show, that while we might not be the most communicative or vocal community, there are a lot of us, and interest in the platform is still high.

Starting off, Ben talked about the features that are still not a well known fact in the current ColdFusion 8. This focused largely on the built in LiveCycle Data Services and the related Flex integration, but a load of people present honestly appeared to not realise this stuff was built into the product.

After a short break, Ben then moved onto the main event, a preview of ColdFusion 9 and the new ColdFusion Eclipse based IDE, Bolt.

Nothing in either of these products,from what I recall, was described as definite but there were a number of notable features that appeared to get people excited. First up was talk about being able to write CFML as CFSCRIPT across the board (CFC’s and all), and then was coverage of the ColdFusion Exposed Services Layer (CFESL) which basically allows third parties to directly call services built into ColdFusion, such as PDF generation or database querying. This single feature provides a whole load of opportunities for developers - for instance, you could have a dedicated PDF generation server called by other servers, or even generate those documents directly from a Flex app without writing any CFML code.

Then Ben went onto talk about the new built-in ORM based on the Hibernate persistence framework. This is a long awaited addition to CF, with the community having had to roll their own versions in the past. Again, details were sketchy, but from what we understand you can create a CFC based off a database table, and a whole load of magic happens in the back end which allows you to query and interact with your database without having to worry about any SQL.

Finally, Ben talked about Bolt. Bolt is the completely new IDE for ColdFusion. Bolt is essentially an Eclipse plugin, allowing elements of CFML code completion and insight. Additionally there were features around code generation and wizards, all of which are aimed at making the CF developers life easier - the underlying ethos of the ColdFusion product.

All in all it was a fantastic night for all, with free drinks and nibbles supplied by Hostway and Adobe (who also provided some raffle prizes for a few lucky attendees.

We’re busy planning the next UKCFUG, so hopefully we’ll see you there!


Comments (0)



UKCFUG - 21 april - Ben forta on the future of ColdFusion

by Neil Middleton 2:51 pm Thursday, 2 April 2009.

Want to know more about ColdFusion’s future? Want to learn more about Flex, LCDS and AIR? And how ColdFusion integrates with them?

Then come to the UKCFUG meeting on Tuesday 21 April at the Adobe’s Regent Park offices in London at 7pm for a special meeting with Ben Forta.

So why not go and register to let us know you are coming (so we can get the beers!)

UPDATE: Free Drinks!

We would like to thank Hostway for sponsoring drinks at this meeting.

Where:
Adobe London Regents Park, 12 Park Crescent, London, W1B 1PH
When:
Tuesday April 21st 2009 7pm - 9pm
Directions:
Nearest Tube - Regents Park

For further information on the UK ColdFusion user group please get in touch.


Comments (0)


Older Posts »