A very useful acronym for use when thinking about requirements. This simple discipline helps a great deal.
Independent
Each and every requirement must be independent. It can exist in itself. If it's too large then reduce it.
Negotiable
Requireemts are not contracts. They are points of conversation and they can evolve. Clients often think that a documented requirement is the end of the story. This causes problems and must be avoided.
Valuable
The requirement should be presented as a value to the client. It makes sense to the client.
Estimable
Requirements are use in planning. Requirements must be granular enough for understanding and estimation.
Sized Appropriately
In Agile, a requirement must be around 50% of the iteration.
Testable
All requirements should be testable to ensure the requirement has been achieved.
Monday, October 31, 2011
Saturday, October 29, 2011
Microsoft's Distributed systems. A potted history.
I began to wonder how many technologies for distributed system that we have moved through since the 90's when I first started using DCOM. COM in VB was my first foray. Happy days.
DCOM and COM+
In the 90's, when programming with Microsoft, we had Distributed COM, DCOM and COM+ to play with if we wanted to get computers to communicate and work together as a system. These technologies were RPC based, worked only with Windows and required the DCOM to be infrastructure available on each node. The COM acronym, Component Object Model, gives us a clue that these were component based technologies.
ES
With .NET came a wrapper for DCOM and Com+ and that was Enterprise Services. This therefore had the same paradigm attributes as pre-.NET, it was RPC and worked only on Windows machines.
Remoting
.NET Remoting came along and was very simple and useful. It was ideal for new developments on new contained systems but it required each node to have the .NET CLR installed. This therefore reduced the effectiveness to only managed code systems running on Windows. It too was RPC in style.
MSMQ
Running alongside these technologies has been Microsoft Message Queue, MSMQ. It has been around since NT 4 and Windows 95. This differed from the other technologies in that rather than the RPC model it concentrated on Messages. It was not component based. But it did still require the nodes to have the MSMQ infrastructure on each node.
So we have:
DCOM/COM+ and ES
.NET Remoting
MSMQ
In the late 90's web-services became prevalent and this enables any platform to communicate to another. Linux to Mac to Windows to whatever. Utilising the ubiquitous HTTP protocol we can use XML for the message formats and they can be in a variety of types - SOAP or RSS etc.
SOAP & REST
SOAP (Simple Object Access Protocol) was the most common protocol specification used and is still very popular. http://en.wikipedia.org/wiki/SOAP
- SOAP is simple.
- It is an XML file.
- The message contains a SOAP ENVELOPE element as the root.
- The Envelope contains a Body element and a Head element.
- Your payload goes in the Body and the some controlling specifications can go into the Header. The controlling specifications are for Security, Reliable Messaging and Transaction features.
The main differing feature between SOAP and RESTful services is tat SOAP is specified to be used on any transport mechanism. REST however is tends only to be used on HTTP.
![]() |
| The SOAP stack |
SOAP can therefore be used on any platform and requires the service contract to be coded in a similar way to RPC
REST (Representation State Transfer) http://en.wikipedia.org/wiki/REST
With REST we treat services as Resources with unique identifies and we use the HTTP defined interface of
- GET,
- POST,
- PUT,
- DELETE and
- HEAD.
ASP.NET Web Services
Microsoft provided ASP.NET Web Services (ASMX) which provided early basic support for SOAP.
Web Services Enhancements
Soon after the ASMX came WSE. This provided some support for the Security, RM and Tx protocols. Also supported were some TCP support. There were however no support for REST.
Microsoft started to create a single model for all their communication frameworks. This became the Windows Communication Framework.
WCF
Now we can use use WCF to write the communication logic and then we can use whatever features we need.
This is a huge step forward. The developer can now write against one single framework even if the requirement is for binary communication over TCP, or SOAP or REST.
Tuesday, October 25, 2011
Thursday, October 20, 2011
The very best Bayes Explanation?
Is by the very interesting Eliezer S. Yudkowsky. Spend some time on his site. It's good to think.
Why is Bayes important?
Here's a story problem about a situation that doctors often encounter:
1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies. A woman in this age group had a positive mammography in a routine screening. What is the probability that she actually has breast cancer?
Next, suppose I told you that most doctors get the same wrong answer on this problem - usually, only around 15% of doctors get it right. Most doctors estimate the probability to be between 70% and 80%, which is wildly incorrect.
What do you think the answer is?
(see below for the answer. See Yudkowsky for why.)
R - Cheat sheet - Matrices
Return to the R Cheat sheet index page
cbind() - Column bind - Equal length vectors can be combined to create a matrix.
> x<-c(1,2,3)
> y<-c(4,5,6)
> x
[1] 1 2 3
> y
[1] 4 5 6
> mm<-cbind(x,y);mm
x y
[1,] 1 4
[2,] 2 5
[3,] 3 6
>
rbind() - As above but Row binding.
> mr<-rbind(x,y);mr
[,1] [,2] [,3]
x 1 2 3
y 4 5 6
>
t( ) - Transpose the matrix.
> mm
x y
[1,] 1 4
[2,] 2 5
[3,] 3 6
> t(mm)
[,1] [,2] [,3]
x 1 2 3
y 4 5 6
>
Build a matrix in one instruction.
> m<-matrix(c(1,2,3,4,5,6), nrow=2);m
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
>
or
> m<-matrix(c(1,2,3,4,5,6), nrow=2, byrow=T);m
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
>
Matrix multiplication
m1 %*% m2 - multiply matrix m1 with matrix m2
> m1<-matrix(c(1,5,10,12), nrow=2);m1
[,1] [,2]
[1,] 1 10
[2,] 5 12
> m2<-matrix(c(3,4,7,9), nrow=2);m2
[,1] [,2]
[1,] 3 7
[2,] 4 9
> m1%*%m2
[,1] [,2]
[1,] 43 97
[2,] 63 143
and using the * operator gives scalar multiplication.
> m1*m2
[,1] [,2]
[1,] 3 70
[2,] 20 108
>
Solve the matrix
solve(m1)
> m1
[,1] [,2]
[1,] 1 10
[2,] 5 12
>
> ms<-solve(m1)
> ms
[,1] [,2]
[1,] -0.3157895 0.26315789
[2,] 0.1315789 -0.02631579
>
> ms%*%m1
[,1] [,2]
[1,] 1 0
[2,] 0 1
>
Eigenvalues and vectors
> m1
[,1] [,2]
[1,] 1 10
[2,] 5 12
> eigen(m1)
$values
[1] 15.458236 -2.458236
$vectors
[,1] [,2]
[1,] -0.5688428 -0.9450825
[2,] -0.8224463 0.3268319
>
Getting elements from a matrix
diag(mm) - Diagonal
cbind() - Column bind - Equal length vectors can be combined to create a matrix.
> x<-c(1,2,3)
> y<-c(4,5,6)
> x
[1] 1 2 3
> y
[1] 4 5 6
> mm<-cbind(x,y);mm
x y
[1,] 1 4
[2,] 2 5
[3,] 3 6
>
rbind() - As above but Row binding.
> mr<-rbind(x,y);mr
[,1] [,2] [,3]
x 1 2 3
y 4 5 6
>
t( ) - Transpose the matrix.
> mm
x y
[1,] 1 4
[2,] 2 5
[3,] 3 6
> t(mm)
[,1] [,2] [,3]
x 1 2 3
y 4 5 6
>
Build a matrix in one instruction.
> m<-matrix(c(1,2,3,4,5,6), nrow=2);m
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
>
or
> m<-matrix(c(1,2,3,4,5,6), nrow=2, byrow=T);m
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
>
Matrix multiplication
m1 %*% m2 - multiply matrix m1 with matrix m2
> m1<-matrix(c(1,5,10,12), nrow=2);m1
[,1] [,2]
[1,] 1 10
[2,] 5 12
> m2<-matrix(c(3,4,7,9), nrow=2);m2
[,1] [,2]
[1,] 3 7
[2,] 4 9
> m1%*%m2
[,1] [,2]
[1,] 43 97
[2,] 63 143
and using the * operator gives scalar multiplication.
> m1*m2
[,1] [,2]
[1,] 3 70
[2,] 20 108
>
Solve the matrix
solve(m1)
> m1
[,1] [,2]
[1,] 1 10
[2,] 5 12
>
> ms<-solve(m1)
> ms
[,1] [,2]
[1,] -0.3157895 0.26315789
[2,] 0.1315789 -0.02631579
>
> ms%*%m1
[,1] [,2]
[1,] 1 0
[2,] 0 1
>
Eigenvalues and vectors
> m1
[,1] [,2]
[1,] 1 10
[2,] 5 12
> eigen(m1)
$values
[1] 15.458236 -2.458236
$vectors
[,1] [,2]
[1,] -0.5688428 -0.9450825
[2,] -0.8224463 0.3268319
>
Getting elements from a matrix
diag(mm) - Diagonal
R - Cheat sheet - Vectors
Return to the R Cheat sheet main index page
Create a vector. (Note the c)
> x<-c(1,2,5,9,15)
> x
[1] 1 2 5 9 15
Create a vector with elements of consecutive integer values.
> x<-1:7
> x
[1] 1 2 3 4 5 6 7
> x<-1:10
> x<-x*2
> x
[1] 2 4 6 8 10 12 14 16 18 20
Some commands
Create a vector. (Note the c)
> x<-c(1,2,5,9,15)
> x
[1] 1 2 5 9 15
Create a vector with elements of consecutive integer values.
> x<-1:7
> x
[1] 1 2 3 4 5 6 7
> x<-1:10
> x<-x*2
> x
[1] 2 4 6 8 10 12 14 16 18 20
Some commands
min(x) - minimum of the elements in x.
max(x) - maximum of the elements in x.
sort(x)
sort(x, decreasing=T)
> y<-c(5,8,2,0,2)
> sort(y, decreasing=T)
[1] 8 5 2 2 0
length(x) - length of vector
x[n] - get nth element from vector. first element is position 1, not position 0.
x[3:7] - get range of elements
> x<-1:10
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x[3:7]
[1] 3 4 5 6 7
x[-5] Get all elements from the vector except the 5th element.
x[x>5] Get the elements whose values are greater than 5.
x > 5 Show which elements in the vector have values greater than b5.
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x> 5
[1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE
Creating sequences
seq(n)
> seq(10)
[1] 1 2 3 4 5 6 7 8 9 10
> seq(0,1,length=10)
[1] 0.0000000 0.1111111 0.2222222 0.3333333 0.4444444 0.5555556 0.6666667
[8] 0.7777778 0.8888889 1.0000000
> seq(0,1,by=0.2)
[1] 0.0 0.2 0.4 0.6 0.8 1.0
length(x) - length of vector
x[n] - get nth element from vector. first element is position 1, not position 0.
x[3:7] - get range of elements
> x<-1:10
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x[3:7]
[1] 3 4 5 6 7
x[-5] Get all elements from the vector except the 5th element.
x[x>5] Get the elements whose values are greater than 5.
x > 5 Show which elements in the vector have values greater than b5.
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x> 5
[1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE
Creating sequences
seq(n)
> seq(10)
[1] 1 2 3 4 5 6 7 8 9 10
> seq(0,1,length=10)
[1] 0.0000000 0.1111111 0.2222222 0.3333333 0.4444444 0.5555556 0.6666667
[8] 0.7777778 0.8888889 1.0000000
> seq(0,1,by=0.2)
[1] 0.0 0.2 0.4 0.6 0.8 1.0
R - Cheat sheet - Basic operations
Return to the R Cheat sheet main index
> # this is a comment line
> # this is a comment line
>2+3
> 2 - 3
> 2 - 3
> log(10) # Natural log
> 3^3 # raising to the power of three
> (2*3)+6
> sqrt(81)
> exp(4) # exponent function
Complex numbers
Re(x) - the Real part of an imaginary number.
Im(x) - the imaginary component of an imaginary number.
> # assign an imaginary number to x
> x <-8+2i
> Re(x)
[1] 8
> Im(x)
[1] 2
Trig
cos(x)
sin(x)
tan(x)
acos(x)
asin(x)
atan(x)
atan2(y, x)
Angles are in radians, not degrees (90deg is π/2).
> exp(4) # exponent function
Complex numbers
Re(x) - the Real part of an imaginary number.
Im(x) - the imaginary component of an imaginary number.
> # assign an imaginary number to x
> x <-8+2i
> Re(x)
[1] 8
> Im(x)
[1] 2
Trig
cos(x)
sin(x)
tan(x)
acos(x)
asin(x)
atan(x)
atan2(y, x)
Angles are in radians, not degrees (90deg is π/2).
R - Cheat sheet - The HELP in R
Return to R Cheat sheet main index
help() - this will bring up help information.
help(topic) - will deliver decimation on the topic.
help.start() - will start the HTML version of the Help.
ls() - will show objects in the path.
dir() - will show files in the current directory.
help() - this will bring up help information.
help(topic) - will deliver decimation on the topic.
help.start() - will start the HTML version of the Help.
ls() - will show objects in the path.
dir() - will show files in the current directory.
R cheat sheet. Some functions and commands in R
I've decided to break this Cheat Sheet over a few blog entries to make it easier to read.
The R project for statistical computing
Link to using Help in R
Basic operations
Vectors
Matrices
Plotting
Stats
Programming
Input and Output
Why did I bother to do this, there are better resources out there.
Try:
http://www.olivialau.org/software/Rtips.pdf
http://www.amaynard.ca/computing/R_Cheatsheet.pdf
The R project for statistical computing
Link to using Help in R
Basic operations
Vectors
Matrices
Plotting
Stats
Programming
Input and Output
Why did I bother to do this, there are better resources out there.
Try:
http://www.olivialau.org/software/Rtips.pdf
http://www.amaynard.ca/computing/R_Cheatsheet.pdf
Wednesday, October 19, 2011
Install R on Mac OSX
Preamble
How to install R onto a Mac. It's very easy.
The R site is here: http://www.r-project.org/
The Mac OS FAQ can be found here: http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html
The FAQ answers questions such as, What machines does R for Max OS X run on?, How to build from source code?
There is also a section on the R.app - that is the GUI application for the Mac.
What releases of OS X
R will run on Mac OS X version 10.2 (Jaguar) or higher.
The GUI application for the Mac requires Mac OS X 10.3 or higher (Panther).
Download and Install
To download R for the mac goto a mirror. The list is on the CRAN page.
Visit the R site is here: http://www.r-project.org/
When you have found a suitable mirror site, download the pkg file.
Run the pkg: and get to this screen and follow the installation through.
Run the R app as normal to start the application.
Job done
That's it. A 32-bit and 64-bit version will be installed.
Getting started
R can be used a simple calculator, for example:
> 2+3
> log(10)
> 3^3
> (2*3)+6
>sqrt(81)
The cheat sheet can be found here. It's useful in getting started.
![]() |
| R used as a simple calculator |
Subscribe to:
Posts (Atom)








