Protected: WP7 Internal screencast

2010 May 6
Enter your password to view comments
by Michael

This post is password protected. To view it please enter your password below:


Hijacking HTTP headers starring Vodafone

2009 September 10
by Michael

Currently I’m working on a mobile website and I’m in the midst of some pain-in-the-arse compatibility issues on page rendering on multiple handsets. I ran across WURFL (Wireless Universal Resource FiLe) , a project which can help you detect a device and to retrieve its device specific properties. WURFL models the properties of wireless/mobile devices in a 13mb XML file.

Next to that there are a lot of APIs (TERA-WURFL PHP, WURFL-PHP, WURFL-Java, WURFL-.NET and WURFL-Perl). I’m using the TERA-WURFL PHP API since I’m also fond of the Smarty template engine. :-)

How it works
The WURFL-PHP API uses a mysql instance to store device specific properties.
A caching mechanisms works on top of the mysql instance to enable lightning fast queries on the database.

By querying the device table (11,000+ rows) using $_SERVER['HTTP_USER_AGENT'], we can now retrieve our device screen width capability:

$width = $wurfl->getCapa('resolution_width'); // get width capability

All capabilities can be found at WURFL’s documentation: http://wurfl.sourceforge.net/help_doc.php.

Back to Vodafone:
Ok, so why does Vodafone suck?

Well, it is all about Vodafone’s reformatting proxy. A what? Yeah, a reformatting proxy. Vodafone uses reformatting proxies to reformat a page to display only the content of interest (ie. article text, article thumbnail, no layout). This comes in handy when a website doesn’t have a mobile design; think about reading Slashdot without a reformat. However, many websites have a mobile specific website nowadays, which leads to better user experience, since reformatted pages are mostly completely stripped down. The big problem in this case is that Vodafone’s reformatting proxy changes crucial HTTP headers..

  • A normal request from a mobile phone:
    HTTP_USER_AGENT => Nokia6288/2.0 (05.92) Profile/MIDP-2.0 Configuration/CLDC-1.1
    HTTP_X_WAP_PROFILE => "http://nds1.nds.nokia.com/uaprof/N6288r100.xml"
  • Vodaphone’s reformatting proxy’s request:
    HTTP_USER_AGENT => = Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/
    Firefox/1.5.0.7 MG (Novarra-Vision/6.1)
    HTTP_X_DEVICE_USER_AGENT => Nokia6288/2.0 (05.94) Profile/MIDP-2.0 Configuration/CLDC-1.1

The reformat proxy changed the HTTP_USER_AGENT header to a desktop browser version [sigh]. HTTP_X_DEVICE_USER_AGENT is a non-standard HTTP header. Hijacking HTTP headers is great sport, way to go Vodafone! Is this just as bad as claiming a color?

References:

Preparing for a trip to Seattle

2009 June 15
by Michael

Hi there! My bachelor project is almost coming to an end: time to graduate! Friday the 26nd of June I have to defend my thesis at the Hogeschool Utrecht. In the meantime I’ll be heading to Seattle to attend an “Oslo” Software Design Review (SDR) from June 19th till 24th which I got invited to by Microsoft. At this event I’ll be discussing experiences I had during the development of a prototype for my bachelor project at Avanade.

Seattle skyline

Next to this event I have some time off to go to Olympic National Park; roam downtown Seattle and have a look on how the American Dream is lived. Or do you have to be asleep to believe it?

The reason they call it the American Dream is because you have to be asleep to believe it.
- George Carlin

Hang around for photos! :-)

Stuck on Venus – Wake up

2009 May 28
by Michael

Next to writing my bachelor thesis which is almost done(!) while writing this post, there was plenty of time to have fun! Together with Anna, Bart and Tijmen we formed a new band called ‘Stuck on Venus’ (no, definitely not Mars!). We shot our first youtube video:

Lyrics by Anna Fernhout.

Using a Makefile to launch Oslo’s executables from Intellipad

2009 March 17

In my previous post I mentioned Bryan Sumter’s GUI tool, which executes the right command from the configuration of the GUI. Sometimes I love my keyboard more than I love my mouse, so I decided to have a try on integrating the tool’s functionality into Intellipad using a Makefile to configure the commands. (Scroll down for download!)

Developing:
First of a snippet from the input Makefile:

###################################### # m builds +m #executable @All #target files = m\*.m out = bin\mx\Image.mx package = Image @AllToRepository files = m\*.m out = bin\sql\ImageRep.sql target = Repository @AllToTsql files = m\*.m out = bin\sql\ImageTsql.sql target = Tsql10

After specifying the input file, we continue..

  • Create MGrammar to parse Makefile to a graph.
  • Compile MGrammar to Mgx or MgxResource to use in the runtime.
  • Build a runtime: at first I wanted to build a runtime in Intellipads scriptengine (IronPython), but I encountered errors on DynamicParser.Parse(), which I couldn’t resolve. Since IronPython was no use for me at the moment, I used the .NET 3.5 Console Application (mmake.exe <executable>.<target>) to parse the graph and execute the build command with the proper parameters from the graph.
  • Create a new Minibuffer command in IronPython which takes a <executable>.<target> as parameter (eg m.All). A new process will be created to call mmake.exe m.All and its stdout will be redirected to a new BufferView in Intellipad.

Python Magic

FindHelper.py

from Microsoft.Intellipad.Host import HostWindow from System.Windows import MessageBox, MessageBoxButton, MessageBoxImage from System.Diagnostics import Process, ProcessStartInfo from System.IO import Directory, Path ... def BuildImpl(activeView, target):     filePath = GetFriendlyFilePath(activeView.Buffer.Uri.AbsolutePath)         if filePath.find("Makefile") >= 0:         hostWindow = HostWindow.GetHostWindowForBufferView(activeView)         buildBuffer = Common.BufferManager.GetBuffer(System.Uri('transient://build'))         Common.Clear(buildBuffer)         view = Common.GetView(hostWindow, buildBuffer)         if view is None:             hostWindow.ShowInRoot(buildBuffer, 40.0)         fileDir = Path.GetDirectoryName(filePath)         (exitCode, stdout, stderr) = RunBuildCommand("mmake", fileDir, target)         Common.Write(buildBuffer, stdout + "\n" + stderr)     else:         message = "Error: Makefile needs to be in the active buffer."         MessageBox.Show(message, IntellipadMessageBoxTitle , MessageBoxButton.OK,  MessageBoxImage.Information) def GetFriendlyFilePath(fileUri):     path = str(fileUri).replace('%20', ' ')     return path.replace('/', '\\') def RunBuildCommand(cmd, pwd, args):     processStartInfo = ProcessStartInfo()     processStartInfo.WorkingDirectory = pwd     processStartInfo.FileName = cmd     processStartInfo.Arguments = args     processStartInfo.UseShellExecute = False     processStartInfo.RedirectStandardOutput = True     processStartInfo.RedirectStandardError = True     process = Process()     process.StartInfo = processStartInfo     process.Start()     process.WaitForExit()     stdout = process.StandardOutput.ReadToEnd()     stderr = process.StandardError.ReadToEnd()     return process.ExitCode, stdout, stderr

MiniBufferCommandSetup.py

def Build(target):         FindHelper.BuildImpl(MiniBufferHelper.GetActiveView(), target)

Running the Makefile:
When I use Intellipad to work on my grammars and models, I have the following directory setup:

Now open up the Makefile in Intellipad:
Note: All paths specified in the Makefile are relative to the path of the Makefile.

Hit Ctrl+/ to bring up the Minibuffer and type: Build(’<executable>.<target>’)
Note: Intellipad needs to know what directory the Makefile is in, so the Makefile buffer should be active (selected) before bringing up the Minibuffer.

Command will run and output to a new BufferView:


Download:

  • Sample project directory (Makefile and samples from Oslo SDK 1.0 for sample builds).
  • mmake (1 runtime, 1 mgx and 2 .py): Extract archive in %PATH_TO_OSLO_SDK%\Bin

Install notes:

  • Add %PATH_TO_OSLO_SDK%\Bin to system var: PATH
  • Backup .py files in case Intellipad stops working: FindHelper.py and MiniBufferCommandSetup.
    %PATH_TO_OSLO_SDK%\Bin\Intellipad\FindHelper.py
    %PATH_TO_OSLO_SDK%\Bin\Intellipad\Components\Microsoft.Intellipad.Scripting\PrivateScripts
  • Write permission errors on %PATH_TO_OSLO_SDK%: fix directory settings.

What’s next?

  • Hyperlinks on buildtargets in Intellipad: click to compile.
  • Resolving IronPython issues with DynamicParser.Parse().
  • Build a horizontal DSL instead of a vertical DSL for Makefiles.

Bugs and errors:
Post bugs or suggestions in the comments or drop me a line via email. :-)

References:


OsloTool, a GUI on top of m.exe, mx.exe, mg.exe and mgx.exe

2009 March 6
by Michael

Bryan Sumter wrote a cool GUI to compile our grammars and models:


Dear readers,

I’ve been working on a small project called “OsloTool” and I thought it would be best to share this with the rest of the Oslo developers. It saved me a lot of time developing Oslo applications.

Basically it’s a Graphical User Interface on top of the commandline tools: mg.exe, mgx.exe, m.exe and mx.exe. Untill Microsoft Implements build-options into IntelliPad u can use this (if you hate commandline as much as I do).

I’ll post the source as well, so you can modify and maybe even expand it.

Screenshot:
http://img9.imageshack.us/img9/1353/oslotool.jpg

Download:
http://michaelwolbert.nl/projects/Oslo/OsloTool.zip (thanks to my dear colleague and friend, Michael Wolbert)

Mirror:
http://www.zshare.net/download/56614958a3fce0d5/

Note:
In “Commands.cs” there is this line of code which specifies Oslo Directory:
static string OsloDirectory = “C:/program files/microsoft oslo sdk 1.0″;

If you got any questions concerning OsloTool feel free to leave a message!

Greeting,
Bryan Sumter

Oslo MSDN Community post

Grab the executable and source here!

Bart Boonstra covers everything, yes everything

2009 March 4

My roommate covered Everything by Michael Bublé. Pretty cool result! (Google translate) :-) I played the bass on the track.

World’s most tiny blogparser written in MGrammar

2009 March 2

My first small parser I’ve written in MGrammar. Nothing fancy though..

I’ve defined the way I’d like to create my blogs, posts and blogrolls in a textual way:

Blog With Title OsloBlog Section Posts Post With Title MGrammar And Desc MGrammar Post With Title Quadrant And Desc Quadrant End Section Section Blogroll Link With Title Oslo And Url http://microsoft.com Link With Title Michael And Url http://michaelwolbert.nl End Section End Blog Blog With Title MichaelBlog Section Posts Post With Title Avanade And Desc Ava Post With Title Testing123 And Desc Testing123456789 End Section End Blog

With our grammar (parser) we can now create projections of our textual DSL:

Blog[ Title[ "MichaelBlog" ], Sections[ Posts[ Post[ Title[ "Avanade" ], Desc[ "Ava" ] ], Post[ Title[ "Testing123" ], Desc[ "Testing123456789" ] ] ] ] ]

Next step would be to push this projections to Oslo’s repository (just a plain ol’ SQL 2008 database), so a runtime can access it. We could also create a runtime which uses a set of classes to parse our textual DSL directly to the runtime. But that will be covered later on.

See this Intellipad screenshot for the textual DSL, the MGrammar and the projections (from L to R).

Some nice samples can be found in the “M” Language Gallery. Especially Natural Language Dates has some good pointers to get started.

Some photos of Denmark 2008 – 2009

2009 February 27
by Michael

Last post I was talking about the hitchhike-adventure to Copenhagen. Guess what, I finally uploaded some of them to my Flickr-account! ;-)

Smokey pipes

We saw some "pretty" smokey pipes from a trainstation somewhere in Denmark.

Been a while!

2009 January 13

I’m still alive and kicking! My last entry was on the 18th of november from Bangalore.. almost two months ago.. I just forgot about my entire blog: holiday, my love leaving for Australia, the fierce weather, study etc.

This week the Innovasia program will be finished with a symposium on our findings in India and on outsourcing in particulair. The new Innovasia website contains a lot of info on our visit to Bangalore for people who are interested or would like to follow the same program next year.

Besides Innovasia, I have been very busy preparing for my intern at Avanade to graduate next semester. Avanade is a joint-venture between Accenture (80%) and Microsoft (20%). Its Dutch office is based in Almere: near Amsterdam. The topic of the project will be focused on model-driven software development using domain specific languages (DSLs). This will be done in Microsoft’s newest platform called Microsoft Oslo. I’m very excited about learning these subjects, because it seems they have become very popular over the years. I’m completely new to this, at least it hasn’t been teached by my university. The start of this intern will be around the 1st of February. I’ll keep you posted!

The holiday was also quite good! :-) Tijmen Ruizendaal and I decided to celebrate NYE somewhere different than our hometown Utrecht. Barcelona, Madrid, Rome, Pisa, Prague, Copenhagen, Berlin.. train, bus, plane.. we really didn’t know where and how to go. We probably waited way to long because flighttickets skyrocketed and traintickets became very scarce. Suddenly we had this thought of getting there without the need of paid transportation: hitchhiking! We decided to go to Copenhagen by the thumb, what a ride and what a stay! :-) I still have to grab some of the photos (not that much) of my camera and upload them to Flickr. Keep around, I’ll upload them soon!