Breaking the Monolith by Stefan Tilkov at QConLondon 2012

Stefan Tilkov (@stilkov) from innoQ gave an excellent talk on the importance of a “system-of-systems approach” to software architecture (Breaking the Monolith, slides [PDF, 1MB]). [Update: the video is now online here: http://www.infoq.com/presentations/Breaking-the-Monolith]

In essence, he argued for a distinction between micro-architecture (the design of the individual [sub]system) and macro architecture (the design of interacting systems).

QConLondon 2012 blog posts
See all QConLondon 2012 blog posts…

Continue reading Breaking the Monolith by Stefan Tilkov at QConLondon 2012

Talk: a Sitecore-based multilingual website (Arabic and English) for Virgin Mobile & Qtel – Dreamcore EU 2011

I presented at the Sitecore partner & developer conference DreamcoreEU in 2011; I spoke about implementing a Sitecore-based multilingual website (Arabic and English) for Virgin Mobile & Qtel [PDF].

DreamcoreEU 2011 logo

I gave a particular emphasis to multilingual concerns and planning for effective web operations:

DreamcoreEU-2012_Multilingual

DreamcoreEU-2012_Operations-4

DreamcoreEU-2011_SOM

(Terrible moiré effect due to stripy shirt – I now have a plain one 🙂 )

To quote from the DreamcoreEU 2011 site:

Going global is much more than just making a site multilingual. If your web properties span the globe, you need to know the best techniques for architecting your Sitecore solution to support a global presence. This session will feature an inside-look at how Virgin Mobile took their brand into to the Middle East. ). The session will cover:

  • Why Sitecore is a first-class WCMS for multi-lingual, left-to-right and right-to-left websites
  • Planning for and implementing right-to-left (RTL) languages in your Sitecore website
  • Using Sitecore’s content modeling to implement product information management (PIM) features
  • Getting your Sitecore content strategy right
  • Developing, deploying and testing multi-server Sitecore installations effectively

In particular, I spoke about how internet technology consultants Priocept had led the effort to roll out the entire system within six months and the challenges we overcame in order to do that, emphasising the need to deploy to Production as early as possible and test with real data, networks and configurations.

Talk: A Scalable Content Platform for TUI Travel – InternetWorld 2011

I presented at Internet World 2011 in London in the Content Management theatre: A Scalable Content Platform for TUI Travel.

Videos

Internet World 2011

Internet World 2011 Squid

 

Slides

Content Platform Solution

[http://www.slideshare.net/matthewskelton/priocept-a-scalable-content-platform-for-tui-travel]

My thanks to TUI Travel for permission to share details of this project at Internet World.

Improving page speed: CDN vs Squid/Varnish/nginx/mod_proxy

Too few people understand the benefit of using a caching reverse proxy server to improve web page delivery speeds, and instead go straight to a CDN solution, which can be costly and complex to administer.

Continue reading Improving page speed: CDN vs Squid/Varnish/nginx/mod_proxy

Calling Javascript from C#

Call JavaScript from C# code, passing parameters and returning results.

I came across a need to call JavaScript methods on HTML code inside a web page from a C# WinForms application. How could that language gap be bridged?

It turns out that Type.InvokeMember() does the trick when using a [Internet Explorer] WebBrowser control to load a web page.

using mshtml;
...
private AxSHDocVw.AxWebBrowser axWebBrowser1;
...
///
 /// Retrieves a reference to the HTML element containing a DIV. /// JavaScript methods are implemented on this element itself. /// 

/// A reference to the HTML element holding the JavaScript methods
private HTMLDivElementClass GetContainer()
{
 HTMLDivElementClass container = null;
 IHTMLDocument2 doc = axWebBrowser1.Document as IHTMLDocument2;

 if (null != doc)
 {
  foreach (IHTMLElement element in doc.all)
  {
   if (element.id == "My_Container")
   {
    container = element as HTMLDivElementClass;
    break;
   }
  }
 }

 return container;
}

///
 /// Gets the text from the container /// 

/// A string containing the text of the container
private string GetText()
{
 string result = null;
 HTMLDivElementClass div = GetContainer();
 if (null != div)
 {
  Type type = div.GetType();
  result = (string) type.InvokeMember(
    "GetText",
    BindingFlags.InvokeMethod,
    null,
    div,
    null);
 }   

 return result;
}

The HTML page loaded in the WebBrowser control has a DIV element with an id of “My_Container”, attached to which is a method called GetText(), which returns some arbitrary text.

Having acquired a reference to the DIV on which the JavaScript method is declared (using GetContainer()), the JavaScript method is called using the InvokeMember() method of the Type class instance; the return value is cast to a string.

Discussion

There is every reason why this should NOT work, but the implementers of the WebBrowser control decided that JavaScript methods living within the DOM should be accessible as first class object members at runtime (in this case, via IDispatch). Nice!

Result

C# code can call arbitrary JavaScript within an HTML page! The only limitation is that the return types of the JavaScript methods can be only simple types (even DateTime is too complex).