Monday, July 26, 2010

Which Walkie Talkie Is Best For City Us

The creative break - holiday cottages

I think I've earned my time, not to think of EBC, CEP, ESB, TDD, BDD, and the many other three-letter abbreviations and the view into the distance may be wandering.

beginning of August I shall be my first dojo (or do you say "my first dojo") visit because it can start with thinking again. But as long as I'm going with sore muscles and feet Badminton . Give

God's post:
Did you know that coots must also be God's children? You can also walk on water.

you soon

January

Friday, July 9, 2010

False Wall Creating Storage

The study - a sample EBC

Again and again I am asked if I can provide a complete example of EBC, which I will do that here.
However, I have to say beforehand that I thought at first that the coding is sufficient by Ralf (Ralf's EBC blog entries ) in order to identify the scope and benefits of the EBC. Since this is not so, I hereby make a first complete example available that were built on the basis of the first generation EBC and its Post from Christopher's ( Christophe review ) inspired.

The scenario

Christof described a board that calculates the gross value of an amount and then rounds the result to two decimal places. He was to bear in mind that a board contains an implicit logic in the wiring, resulting from the task. One could make the rounds before or after the calculation.
At this point I want to talk but no implicit or explicit logic in the board, but EBC present in a sample. I opted for the round after the calculation.
textual formulation of the components
quote from Christophe's post:
"Component A:
- calculating VAT from an input
- Input: any number
- Issue: Entry * value added tax rate (2% :-())

Part B:
- Task: Formatting the input
- Input: any numbers
- Issue: number with exactly 2 decimal places, if necessary suitably rounded

Both devices are connected to board "VAT" "
Graphic formulation - Wiring Diagram
EBC VatBoard This diagram shows the components and the interaction, ie the. Making the first requirement to calculate and then by rounding, dar.
I plead for a tool to have with the wiring is shown graphically, because this form of representation is much easier to understand than the underlying code.

The project

EBC VatBoard Project
The Solution Project (Visual C # 2010 Express) I have to request such a way that is clear, where what happens. A project for the contracts, one for the implementation and one for the tests. So that it is running and can be tried once, I have not created a motherboard that instantiates the Tax Board and shall provide the parts.
Unfortunately I have to mix Concerns, because I have no further project for EBC is planned to open the framework, as a component, the numbers round, has now really looking to do with the calculation of gross value. But looking ahead I have the component and its carrying Contract de.ebc.Framework in the namespace for the event that it would later be such a framework.
The tests are still (!) Implemented with NUnit, but I prefer Behavior Driven Testing, and will probably get in the near future or NSpec MSpec back out of mothballs and then write all my tests with it. I find this kind of testing much easier to understand.
The Contracts
The Contracts define the components, that is not special, because now should be state of the art. The special feature of these contracts but the fact that no pins are defined and methods, functions and / or fields.
Good, the input pin is also a method, but that is the nature of the thing. In some way so the signal must be, the message will be introduced into the component. It must, however, a fundamental difference between the pins of a board and where the parts are made.
In some tests, I checked the readability of the code by using pin variations and found that the difference increases the readability.
here once a complete example using the method of Ralf;
  / / Variant 1 InPin  
/ / In Contract:
public interface IComponent {
void In_InMessage ( TypeOfMessage message ) ;
}

/ / The board
public class MyBoard {

private Action \u0026lt; TypeOfMessge > _channelMethod ;

public MyBoard ( IComponent component) {
/ / wiring on the board
this . _channelMethod = component. In_InMessage ;
...
}

/ / Board InPin
public void In_BoardMessage ( MessageType message ) {
this . _channnelMethod ( message ) ;
}}

This version I think While quite nice, but I did not find it particularly easy to read. Just the need for an extra box _channelMethod "came to pass in order to define the message to the first of the first component InPin me bulky. Other tools such as wire

classes that connect the pins have not please me. So I have found by trial and error the following variant of sufficiently good.


EBC Pins


  1. namespace de.ebc.Framework
  2. {
  3. public delegate void InPin \u0026lt;TInput> (TInput inmessages);
  4. public delegate void OutPin \u0026lt;TOut> (Tout outMessage);}



How these pins can be integrated into the code you see in the following codeing.

I start with the definition of the board, on which the two parts are connected. Two pins on the board are defined. One receives the message (In_CalcToGross) and the other returns the result (Out_Gross). Attention, here is the InPin as Field have been defined from the said above reason.


EBC IVatBoard Contract


  1. namespace de.ebc.vatboard
  2. {/ / / \u0026lt;summary>
  3. / / / Defines a component that can handle VAT
  4. / / / \u0026lt;/ summary>
  5. public interface IVatBoard
  6. {
  7. / / / \u0026lt;summary>
  8. / / / Computes the gross value of a number
  9. /// </summary>
  10.          /// <param name="netto"></param>
  11.          InPin < Decimal > In_CalcToGross { get ; set ; }
  12.  
  13.          / / / \u0026lt;summary>
  14. / / / Is the gross returns
  15. / / / \u0026lt;/ summary>
  16. event OutPin \u0026lt; Decimal > Out_Gross;
  17. }}



The component that performs the calculation is defined by the interface IVatCalculator. Again, it is no surprise, because it describes only the required pins. However, a part of InPin not represented by a delegate, here again is a method used.


EBC IVatCalculator Contract


  1. namespace de.ebc.vatboard
  2. {
  3. / / / \u0026lt;summary>
  4. / / / Defines a component that calculates the gross value of a number
  5. / / / \u0026lt;/ summary> public
  6. interface IVatCalculator
  7. {
  8. / / / \u0026lt;summary>
  9. / / / Berchnet the gross value of a number
  10. ; / / / \u0026lt;/ summary>
  11. / / / \u0026lt;param name="netValue"> \u0026lt;/ param>
  12. void In_CalculateGross ( Decimal NetValue);
  13. / / / \u0026lt;summary>
  14. / / / Is the gross returns
  15. / / / \u0026lt;/ summary>
  16. event OutPin \u0026lt; Decimal > Out_Gross;
  17. ;}}



Now even the definition of the component that takes the rounding of numbers, and you are ready Contracts. Note that this contract is not the namespace of the VatBoards is assigned (for reasons of Separation of Concerns).


EBC IRoundDecimals Contract


  1. namespace de.ebc.Framework
  2. {/ / / \u0026lt;summary>
  3. can / / / Defines a component, round the numbers
  4. / / / \u0026lt;/ summary>
  5. ; public interface IRoundDecimals
  6. {
  7. / / / \u0026lt;summary>
  8. / / / number rounded to two decimal
  9. /// </summary>
  10.          /// <param name="number"></param>
  11.          void In_RoundingToTwoDecimals( Decimal number);
  12.         
  13.          / / / \u0026lt;summary>
  14. / / / Returns the number rounded back
  15. ; / / / \u0026lt;/ summary>
  16. event OutPin \u0026lt; ; Decimal > Out_RoundedNumber;
  17. }}


The Components (Parts and boards) What is to be expected, the components of the meat of the Contracts and it is waiting for us, again, no surprise.
First, the Board, which is home to the wiring.

EBC VatBoard


  1. namespace de.ebc.vatboard.Components
  2. {
  3. public class VatBoard : IVatBoard
  4.     {
  5.          public VatBoard( IVatCalculator vatCalculator, IRoundDecimals numberRounder)
  6.         {
  7.              / / InPin the Board with the first component wiring
  8. this In_CalcToGross = vatCalculator.In_CalculateGross;.
  9. / / Result for rounding to the next component forward
  10. vatCalculator.Out_Gross + = numberRounder.In_RoundingToTwoDecimals;
  11. ;
  12. / / round number return
  13.             numberRounder.Out_RoundedNumber += this .OnOutRoundedNumber;
  14.         }
  15.  
  16.          private void OnOutRoundedNumber( Decimal number) {
  17.              this .Out_Gross(number);
  18.         }
  19.  
  20.          public InPin < Decimal > In_CalcToGross {
  21.              get ;
  22.              set;}
  23. public event OutPin \u0026lt; decimal> = Out_Gross delegate {};}
  24. }



Here is visible, why I have a Delegeate InPin use, because I can now InPin connect the board directly with the InPin of the first component, no code noise.

Now just the two working components:

EBC VatCalculator


  1. namespace de.ebc.vatboard.Components
  2. {
  3. public class VatCalculator : IVatCalculator
  4. {
  5. public VatCalculator ( decimal vatInPercent) {
  6.              this .VatInPercent = vatInPercent;
  7.         }
  8.  
  9.          public Decimal VatInPercent { get ; private set ; }
  10.  
  11.          public void In_CalculateGross( decimal netValue)
  12.         {
  13.              Decimal gross = GetGross(netValue);
  14.              this .Out_Gross(gross);
  15.         }
  16.  
  17.          private decimal GetGross( decimal netValue)
  18.         {
  19.              return netValue * (1 + VatInPercent / 100);
  20.         }
  21.  
  22.          public event OutPin < decimal > Out_Gross = delegate { };
  23.     }
  24. }



und


EBC RoundDecimals


  1. namespace de.ebc.vatboard.Components
  2. {
  3.      public class RoundDecimals : IRoundDecimals
  4.     {
  5.          public event OutPin < decimal > Out_RoundedNumber = delegate { };
  6.  
  7.          public void In_RoundingToTwoDecimals( decimal number)
  8.         {
  9.              decimal roundedNumber = RoundNumber(number);
  10.              this .Out_RoundedNumber(roundedNumber);
  11.         }
  12.  
  13.          private decimal RoundNumber( decimal number)
  14.         {
  15.              return Decimal Round (number, 2);.
  16. }
  17. }}



Yes, it can be refactored, I see it now, but for the example is not relevant now.

When I wrote the code well, it needs no further explanation of what happened here. And to determine this, I will make no further comment, because I hope for what the reader ;-)
The testing of the solution Testing is simple, because I can test each component individually through their paces. I could also try all the modules for the test and create. I have not done here.
As mentioned NUnit is used, what will I think change in the near future.

Testing of VatCalculator component is a fixed net value of 12 to send into the component into it, only to receive the gross value and evaluate.


testing VatCalculator


  1. [ TestFixture ]
  2. public class TestVatCalculator : WithVatCalculator
  3. {
  4.     [ Test ]
  5.      public void Calculate_For_Number_12()
  6.     {
  7.          decimal netValue = 12;
  8.          decimal vat = this .VatCalculator.VatInPercent;
  9.          decimal shouldBrutto = (netValue * (1+vat/100));
  10.  
  11.          this .VatCalculator.Out_Gross += brutto =>
  12.         {
  13.              Assert AreEqual (should gross, gross).
  14. };
  15. ;. this VatCalculator.In_CalculateGross (NetValue);
  16. }}



Yes well, it's not really the Brain Burner, but it illustrates the ease with which an EBC can be tested.

The second Component, the curvature component, we tested the same way.


testing RoundDecimals


  1. [ TestFixture ]
  2. public class TestRounding : WithRoundDecimals
  3. {
  4. [ Test ]
  5. public void Round_To_Two_Decimals () {
  6. ; decimal aNumber = 12.34567m;
  7.          this .RoundDecimals.Out_RoundedNumber += roundedNumber =>
  8.         {
  9.              Assert .AreEqual(12.35m, roundedNumber);
  10.         }; .
  11. this RoundDecimals.In_RoundingToTwoDecimals (aNumber);}
  12. }



The solution as an application
And how the whole thing looks in the application context?

I chose the example of the Console, which is not really about rachend and then the call to the following terms:


VatBoard as application


  1. namespace de.ebc.VatMainBoard
  2. {
  3.      class Program
  4.     {
  5.          static void Main( string [] args)
  6.         {
  7.  
  8.              Decimal vat = 16m;
  9.  
  10.              IVatCalculator vatCalculator = new VatCalculator (vat);
  11.              IRoundDecimals numberRounder = new RoundDecimals ();
  12.  
  13.              IVatBoard vatBoard = new VatBoard (vatCalculator, rounder number);
  14. / / Result output
  15. vatBoard.Out_Gross + = large => {
  16. Console .WriteLine(gross);
  17.             };
  18.  
  19.              string netValueString = Console .ReadLine();
  20.              Decimal netValue = 0;
  21.  
  22.              Decimal .TryParse(netValueString, out netValue);
  23.             vatBoard.In_CalcToGross(netValue);
  24.  
  25.              Console ReadLine ();.
  26. }
  27. }}



And not lose many words because it is just an example and it should explain itself, otherwise I've just not written well.

The project can be downloaded from CodePlex at the following link EBC samples.

Well then ran times and forth with the comments.


Jan (ek)

Saturday, July 3, 2010

How To Reserve A Flight On Expedia

Control of Leafpositionen




were used:
  1. a "50% bloc"
  2. an aluminum plate d = ca 2mm with marking holes adjusted to the isocentre
  3. including a memory film from Fuji
  4. a flashlight to brighten the marking points after irradiation
  5. tape and the reader from Fuji to the imaging plates
  6. my Freeware DicoRView for evaluation






example

Justierfeld
  • irradiate in the left part is the effect of blocking, 2 be identified.
  • The height of the blocks is such that measured below that are below the aluminum plate 50% of the dose of the remaining field (with a 2D array)
  • The white markers are recognized:
    illumination of the holes after irradiation removes the film at this point. can





















isoline set
  • With over up to 3 points, colored lines are set, all pixels with the same blackening . Connect
  • the reference point for the line with the color magenta in the area below the 50% block - corresponds to this line so the 50% isodose.
  • blue and green correspond to about 80% and 20%






















isocenter and scale define
  • By moving the 2 scaling points "zero" and "(0cm, 10cm), the coordinate system is adjusted to the Markierpunkte.




















  • guide points to each of the three contour lines can be any number of auxiliary points are created.
  • 2 each auxiliary points are connected by a line (here blue and white dotted lines)
  • is at each of two resulting lines of the center line drawn
  • the vertical blue line in the small picture is the center line of the irradiated field compared the Y-axis of the coordinate















calculate the
Leafpositionen
  • can Leafpositionen be drawn to one of 3 possible isolines
  • Scheme: 40 Leafpaare with 1 cm width (eg Elekta MLCi)
  • the guide points of the isoline determine the line segment adapted to the.
  • here the Leafs at the blue line are related - (Note: this is in the example is not correctly set, for positioning the 50% line would be correct)