Microsoft Business Plan

The microsoft business model is based upon the perpetual upgrade cycle.
They make their users into part of the sales force.

For example some new versions of word seem to break backwards compatibility.  For example Word 2007 by default saves the documents in a docx file.  To the naive end user that means that if a friend or business partner starts sending these files then they must upgrade to the new version.  Microsoft has the cheek to call the GPL viral!

It is amazing the range of development tools that microsoft put out to make developers life easier – at a price.
The new workflow (WF), presentation (WPF) and communication (WCF) stacks are very compelling for the developer.  The catch is that you need to either write your apps as a web application or upgrade your entire workforce to XP or above.  There are plenty of companies that have a mixed W2k and XP environment – these new tools cannot be used without an upgrade!

Top 100 Languages

Here is the latest list of the top 100 languages.

How many of them do you use/have you used?

Position
Apr 2008
Position
Apr 2007
Programming Language Ratings
Apr 2008
Delta
Apr 2007
Status
1 1 Java 20.529% +2.17% A
2 2 C 14.684% -0.25% A
3 5 (Visual) Basic 11.699% +3.42% A
4 4 PHP 10.328% +1.69% A
5 3 C++ 9.945% -0.77% A
6 6 Perl 5.934% -0.10% A
7 7 Python 4.534% +0.72% A
8 8 C# 3.834% +0.28% A
9 10 Ruby 2.855% +0.06% A
10 11 Delphi 2.665% +0.33% A
11 9 JavaScript 2.434% -0.70% A
12 14 D 1.169% -0.35% A
13 13 PL/SQL 0.608% -1.28% B
14 12 SAS 0.572% -1.63% A–
15 21 Pascal 0.513% -0.06% B
16 17 Lisp/Scheme 0.476% -0.20% B
17 22 FoxPro/xBase 0.459% -0.09% B
18 18 COBOL 0.409% -0.24% A–
19 16 Ada 0.393% -0.29% B
20 31 ColdFusion 0.384% +0.11% B

21 to 50

Position Programming Language Ratings
21 Logo 0.383%
22 Lua 0.378%
23 ActionScript 0.362%
24 Fortran 0.335%
25 RPG 0.297%
26 MATLAB 0.257%
27 Prolog 0.244%
28 Awk 0.228%
29 Transact-SQL 0.206%
30 ABAP 0.204%
31 LabView 0.178%
32 Erlang 0.144%
33 Groovy 0.142%
34 Smalltalk 0.137%
35 Haskell 0.137%
36 PL/I 0.134%
37 Bash 0.127%
38 Objective-C 0.116%
39 Tcl/Tk 0.114%
40 CL (OS/400) 0.110%
41 ML 0.106%
42 Forth 0.102%
43 APL 0.102%
44 REXX 0.102%
45 R 0.101%
46 PowerShell 0.096%
47 Euphoria 0.092%
48 Ch 0.091%
49 Natural 0.090%
50 Caml 0.089%

The next 50:

  • ABC, Algol, Alpha, Applescript, AspectJ, Beta, Boo, cg, Clean, Csh, cT, Curl, DC, Dylan, Eiffel, EXEC, Factor, Felix, Focus, Icon, IDL, Inform, Io, Limbo, Lingo, MAD, Magic, Maple, Mathematica, Modula-2, MOO, MUMPS, Oberon, Occam, Oz, Pike, Postscript, Powerbuilder, Progress, Q, REALbasic, Rebol, S-lang, Scala, SIGNAL, SPSS, VBScript, Verilog, VHDL, XSLT

Personally I have no used Java in years, nor C/C++.

Visual Basic deserves to be split into its VB6 and Visual Fred components. (I have unfortuanately used both of these in the last 3 years).

I use php for a website that I maintain.

Perl, Python, C# and Delphi have all been used.
My raw pascal has not been touched for years.

Futher down the list I have used: Fortran (a long time ago), T-SQL, Tcl/Tk, APL.

Of the bottom items: Boo, Powerbuilder (powerblunder), VBScript

Not sure how accurate this list is.

Pure Boo WCF problem

I have been trying to create a pure WCF service that exposes metadata.
Learning WCF implies that MexHttpBinding exists as a class that can be used like HttpBinding.

Unfortuantely I get HTTP 405 errors!

The following host:

namespace IndigoService

import System
import System.ServiceModel
import System.ServiceModel.Description

host = ServiceHost(typeof(IndigoService.HelloIndigoService), Uri(“http://localhost:8000/HelloIndigo”))

mexBehaviour = ServiceMetadataBehavior()
mexBehaviour.HttpGetEnabled = true
host.Description.Behaviors.Add(mexBehaviour)

host.AddServiceEndpoint(typeof(IndigoService.IHelloIndigoService), BasicHttpBinding(), “HelloIndigoService”);
host.AddServiceEndpoint(typeof(System.ServiceModel.Description.IMetadataExchange), BasicHttpBinding(), “mex”);

host.Open();
print “Press any key to terminate”
Console.ReadKey()

Running the service and calling:

C:devboowcf>svcutil /o:serviceproxy.cs /config:app.config http://localhost:8000/HelloIndigo/mex

Produces the following errors:

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from ‘http://localhost:8000/HelloIndigo/mex’ usi
ng WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from http://localhost:8000/HelloIndigo/mex

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess.  For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.

WS-Metadata Exchange Error
    URI: http://localhost:8000/HelloIndigo/mex

    Metadata contains a reference that cannot be resolved: ‘http://localhost:800
0/HelloIndigo/mex’.

    Content Type application/soap+xml; charset=utf-8 was not supported by servic
e http://localhost:8000/HelloIndigo/mex.  The client and service bindings may be
 mismatched.

    The remote server returned an error: (415) Cannot process the message becaus
e the content type ‘application/soap+xml; charset=utf-8’ was not the expected ty
pe ‘text/xml; charset=utf-8’..

HTTP GET Error
    URI: http://localhost:8000/HelloIndigo/mex

    There was an error downloading ‘http://localhost:8000/HelloIndigo/mex’.

    The request failed with the error message:

<s:Envelope xmlns:s=”http://schemas.xmlsoap.org/soap/envelope/”><s:Body><s:Fault
><faultcode xmlns:a=”http://schemas.microsoft.com/ws/2005/05/addressing/none”>a:
ActionNotSupported</faultcode><faultstring xml:lang=”en-GB”>The message with Act
ion ” cannot be processed at the receiver, due to a ContractFilter mismatch at
the EndpointDispatcher. This may be because of either a contract mismatch (misma
tched Actions between sender and receiver) or a binding/security mismatch betwee
n the sender and the receiver.  Check that sender and receiver have the same con
tract and the same binding (including security requirements, e.g. Message, Trans
port, None).</faultstring></s:Fault></s:Body></s:Envelope>
–.

If you would like more help, type “svcutil /?”

It appears that mex must be enabled in a config file – you can’t do it in code!

wcf demo in Boo

This is the promised simple wcf demo in boo.

It is based upon the examples in Learning WCF by Michelle Leroux Bustemante.

### Contract.boo ###
namespace IndigoService

import System.ServiceModel

[ServiceContract(Namespace:”http://foo/bar&#8221;)]
interface IHelloIndigoService:
    [OperationContract]
    def SayHello() as string:
        pass

### Service.boo ###
namespace IndigoService

#import System.ServiceModel
   
class HelloIndigoService(IHelloIndigoService):
    def SayHello() as string:
        return “Hello Indigo”

### Host.boo ###
namespace IndigoService

import System.ServiceModel
import System

host = ServiceHost(typeof(IndigoService.HelloIndigoService), Uri(“http://localhost:8000/HelloIndigo&#8221;))
host.AddServiceEndpoint(typeof(IndigoService.IHelloIndigoService), BasicHttpBinding(), “HelloIndigoService”);
host.Open();
print “Press any key to terminate”
Console.ReadKey()

### Client.boo ###
namespace IndigoService

import System
import System.ServiceModel

try:
    ep = EndpointAddress(“http://localhost:8000/HelloIndigo/HelloIndigoService&#8221;)
    proxy as IHelloIndigoService
    proxy = (ChannelFactory [of IHelloIndigoService]).CreateChannel(BasicHttpBinding(),ep)
    Console.WriteLine(proxy.SayHello())
    Console.ReadKey()
except e:
    print “Problem with server – probably not there”
    # print e

### default.build ###
<?xml version=”1.0″ ?>

<project name=”wcfdemo” default=”build”>
<property name=”boo.dir” value=”C:/boo/bin” />
    <target name=”build” depends=”wcfserver,wcfclient” />
    <target name=”wcfserver”>
        <loadtasks assembly=”${boo.dir}/Boo.NAnt.Tasks.dll” />
                 <booc output=”wcfserver.exe” target=”exe”>
            <references>
                <include name=”C:/Program Files/Reference Assemblies/Microsoft/Framework/v3.0/*.dll” />
            </references>
            <sources>
                <include name=”Service.boo” />
                <include name=”Host.boo” />
                <include name=”Contract.boo” />               
            </sources>
        </booc>
    </target>
    <target name=”wcfclient”>
        <loadtasks assembly=”${boo.dir}/Boo.NAnt.Tasks.dll” />
                 <booc output=”wcfclient.exe” target=”exe”>
            <references>
                <include name=”C:/Program Files/Reference Assemblies/Microsoft/Framework/v3.0/*.dll” />
            </references>
            <sources>
                <include name=”Client.boo” />
                <include name=”Contract.boo” />               
            </sources>
        </booc>
    </target>
</project>

Improved wpf demo

Here is an improved version of the wpf demo.  The older posts build script still applies.

I need to attribute this site for giving me hints to go in the right direction.

import System

import System.Windows

import System.Windows.Controls

import System.Windows.Navigation

  

class Exer1(NavigationWindow):

            para as TextBlock

            button as Button

           

            def constructor():

                        para = TextBlock(Text:”Hello World!!!”, FontSize:36)

                        para.VerticalAlignment = VerticalAlignment.Center

                        para.HorizontalAlignment =HorizontalAlignment.Center  

                        # create a button


//<![CDATA[

//]]>
                        button = Button(Content:”Click Me”, Height:30, Width:100)

                        # display the textblock when the button is clicked

                        button.Click += NavButtonClick

                        # display the button first

                        Navigate(button)

                       

            protected def NavButtonClick(sender as object, e as RoutedEventArgs):

                        Navigate(para)

                                   

                       

[STAThread]

def Main():

            app = Application()        

            Exer1().Show()

            app.Run()

Boo compiler warning

The latest Boo release is 0.8.1

Boo build 0.8.1.2865 appears to be broken.

Code that works fine under 0.8.0.2730 fails to compile.

Apparently the latest source from subversion works fine.

Some of my samples were blowing up with unknown key errors, mostlty when assigning events.

Boo Compiler Options

There are lots of options for building Boo.

I got fed up having to look up the options so I have them all here.

Usage is: booc [options] file1 …
Options:
 -c:CULTURE           Sets the UI culture to be CULTURE
 -debug[+|-]          Generate debugging information (default: +)
 -define:S1[,Sn]      Defines symbols S1..Sn with optional values (=val) (-d:)
 -delaysign           Delays assembly signing
 -ducky               Turns on duck typing by default
 -checked[+|-]        Turns on or off checked operations (default: +)
 -embedres:FILE[,ID]  Embeds FILE with the optional ID
 -lib:DIRS            Adds the comma-separated DIRS to the assembly search path
 -noconfig            Does not load the standard configuration
 -nostdlib            Does not reference any of the default libraries
 -nologo              Does not display the compiler logo
 -p:PIPELINE          Sets the pipeline to PIPELINE
 -o:FILE              Sets the output file name to FILE
 -keyfile:FILE        The strongname key file used to strongname the assembly
 -keycontainer:NAME   The key pair container used to strongname the assembly
 -reference:ASS       References the specified assembly (-r:ASS)
 -srcdir:DIR          Adds DIR as a directory where sources can be found
 -target:TYPE         Sets the target type (exe, library or winexe)
 -resource:FILE[,ID]  Embeds FILE as a resource
 -pkg:P1[,Pn]         References packages P1..Pn (on supported platforms)
 -utf8                Source file(s) are in utf8 format
 -v, -vv, -vvv        Sets verbosity level from warnings to very detailed
 -wsa                 Enables white-space-agnostic build

Direct compile line:

booc -t:library bender.boo

booc wpfdemo.boo -r:PresentationCore.dll -r:PresentationFramework.dll -r:WindowsBase.dll

Note you can supply multiple boo source files to split the project.

Nant build script:

<?xml version=”1.0″ ?>
<project name=”wpfdemo” default=”build”>
<property name=”boo.dir” value=”C:/boo/bin” />
    <target name=”build” depends=”wpfdemo” />
    <target name=”wpfdemo”>
        <loadtasks assembly=”${boo.dir}/Boo.NAnt.Tasks.dll” />
                 <booc output=”wpfdemo.exe” target=”winexe”>
            <references>
                <include name=”C:/Program Files/Reference Assemblies/Microsoft/Framework/v3.0/*.dll” />
            </references>
            <sources>
                <include name=”wpfdemo.boo” />
            </sources>
        </booc>
    </target>
</project>

You can also use msbuild:

<Project DefaultTargets=”Build” xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″&gt;
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <RootNamespace>Bake.Example</RootNamespace>
    <AssemblyName>Bake.Example</AssemblyName>
    <Configuration Condition=” ‘$(Configuration)’ == ” “>Debug</Configuration>
    <Platform Condition=” ‘$(Platform)’ == ” “>AnyCPU</Platform>
    <ProjectGuid>{707667FA-CDCB-4756-9EF0-96DB18A53DCD}</ProjectGuid>
    <NoStdLib>False</NoStdLib>
    <Ducky>False</Ducky>
  </PropertyGroup>
  <PropertyGroup Condition=” ‘$(Configuration)’ == ‘Debug’ “>
    <BaseIntermediateOutputPath>obj</BaseIntermediateOutputPath>
    <IntermediateOutputPath>objDebug</IntermediateOutputPath>
    <OutputPath>….bin</OutputPath>
    <Optimize>False</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>Full</DebugType>
  </PropertyGroup>
  <PropertyGroup Condition=” ‘$(Configuration)’ == ‘Release’ “>
    <BaseIntermediateOutputPath>obj</BaseIntermediateOutputPath>
    <IntermediateOutputPath>objRelease</IntermediateOutputPath>
    <OutputPath>….bin</OutputPath>
    <Optimize>True</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <DebugSymbols>false</DebugSymbols>
    <DebugType>None</DebugType>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include=”Program.boo” />
  </ItemGroup>
  <ItemGroup>
    <Content Include=”example.boobs” />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include=”..bake.engineBake.Engine.booproj”>
      <Project>{B86E7336-0498-486D-A199-FC19ED9740AF}</Project>
      <Name>Bake.Engine</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project=”$(BooBinPath)Boo.Microsoft.Build.targets” />
</Project>

Bake:

import Bake.IO.Extensions

Task(“default”, [“test”])

Task(“compile”, [“codeGen”]) do:
    print “> do compile stuff”

Task(“dataLoad”, [“codeGen”]) do:
    print “> do dataLoad stuff”

Task(“codeGen”) do:
    print “> do codeGen stuff”

Task(“test”, [“compile”, “dataLoad”]) do:
    print “> do test stuff”
    print Configuration.test

Boo build system

Here is a build system that is pure Boo.

It was called BooBS and may be transitioning to Bake.

This reminds me of a build tool that I built once in Python.
It would do the packaging and deployment details but left the compilation to want (the delphi port of nant).
There are big advantages of having the build tool in a scripting language.  This makes fixes much easier and quicker – which you really need if you are trying to get an emergency build out.

Having an automated build tool seriously improves the quality of a build – it reduces the bar on releases so you don’t need a hideous checklist.  I found the need for it when I forgot to release half of the dll’s for a project once.

These days I would recommend creating an automated installer as part of the build.  This seriously reduces the mistakes that the instalation engineer makes.