Author: admin

  • What is a routed event?

    What is a routed event?

    This is the answer that is typical on Stack Overflow sites and other such forums:

    A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event.

    It seems – with all due respect to those coders – are not applying the old programming adage:

    Always write explanations as if the guy who ends up reading it is a violent psychopath who knows where you live.

    Now such MSDN techno-speak just hurts everyones’ heads. Why can’t they just speak plain English? I’m no expert, but here it is explained simply so that you can understand:

    Explanation By Analogy: What is a routed event?

    Our judicial system employs routed events. Suppose that somebody commits a crime. This is an “event”. This event can be handled in any one of the following courts, (from the lowest court to the highest court in the land, respectively):

    1. Lower/Magistrate court
    2. County/Distruct Courts
    3. Supreme Court
    4. State/Territory Court
    5. The High Court
    6. The Privy Council
    7. and above that: The Supreme Court of the Galactic Republic

    Now, as is the case, all courts have jurisdiction over the matter. A petty theft can be tried in the High Court – if you wanted to. The High court has jurisdiction, but is that what you really want? Most cases start off in the Lower courts, and then, if required, the matter is passed onto a higher court. And if so required, that court passes on the matter to a still higher court. It can go all the way to the top.

    Or on the other hand, if you so decide: the theft can be handled at the lower court, and the matter can end there.

    Routed events work the same way. If an event happens in the lower court, you, the programmer, can so choose to have the event “bubble up” and be handled by a higher court. The matter can go as high up as you wish and can be taken care of there.

    Now that, in effect, is how routed events work. Something which starts in the Lower Court can be passed on and can be “handled” and heard in the Privy Council. And that’s it! So simple? Yet everyone tries to make it so complicated!

  • What is an event?

    Assumed knowledge:

    • Assume you know what a method is.

     

    What is an event?

    Let’s keep it simple. An event is anything which “happens”. “Oh great! That helps a lot :’(  ,“ I hear you say. Examples are in order:

    • The President comes to town. He could come at anytime. You don’t know when he could come. So when he comes, it’s an event.
    • Somebody wins the lottery.
    • A house catches fire.
    • Somebody clicks a button.

    All of these are events.

    What happens next?

    • Subscribers explained

    What happens when an event happens? Anything you want!

    Just say a house catches on fire. We will call this event “HouseFireEvent”. When this event is raised (i.e. when it happens), the following occur:

    • People start screaming “OMMAGOD OMMAGAD!” (let’s call this the scream method)
    • They call the fire department. (let’s call this the call-fire-department method)
    • A fireman puts the fire out. (let’s call this the extinguish method).

    In other words, the above methods are “called” when the house-fire event is raised. The house-fire event in fact maintains a list of methods which occur or are run when an event is raised. These methods are called subscribers. How can an event maintain a list of methods you ask? Good question. Usually there is a big book the fire warden in the floor of your department has tucked away in the back drawer of his desk. This book details all the protocols which must be followed when there is a fire. i.e. examples include: (i) staying calm, (ii) taking any valuables you have with you but no more, (iii) evacuating the building in an orderly and calm manner. These instructions, or “methods” are also known as “event handlers” because they are procedures which are called when a particular event occurs.

    So in the above example, the event handlers would be: (i) Scream method, (ii) call-fire-department method and lastly (iii) the extinguish method.

     

    ………that’s it – it’s as simple as that!

  • What is a call-back function?

    Example by Parable and Analogy

    I have a secretary. At the end of the day, I ask her to: (i) take the firm’s outgoing mail and to drop it off at the post office, and in addition to that, after she has dropped the mail off, I ask her to do something else: (ii) whatever task I wrote for her on one of those sticky notes. Now, what is the task on the sticky-note? It depends on the day. Sometimes it might be to: (i) purchase some stationary. Other times it might be to: (i) file some papers, (ii) send some emails, (iii) print some documents etc.

    Suppose on this particular day, I require her to print off some documents. In summary, first, she needs to drop off the mail and immediately after that is done, she needs to print off some documents.

    Applying the story to some techno-computer geek speak

    The method name in this case is: DropOffMail. And the call back function is: PrintOffDocuments. The PrintOffDocuments is the call back function because we want the secretary to do that, only after PrintOffDocuments has run.

    So I would “pass: PrintOffDocuments as an “argument” to the DropOffMail method. Now the DropOffMail method must be able to accept functions in its method signature. After the DropOffMail is run, then the call back function, PrintOffDocuments would be called and would run.

    So in short, the mail would be delivered, and she would run a print job (which would be the call-back function).

    I hope that was simple enough for you!

  • What is an ObservableCollection?

    For those wanting a simple answer without the geek-speak, I’ll try to explain:

    Normal Collections

    Every now and then I go to NYC and my friend asks me to buy stuff for him. So I take a shopping list with me. The list has a lot of things on there like:

    1. Hugo Boss jacket
    2. Clive Christian’s Imperial Majesty ($215,000/16.9 oz.)
    3. Mont Blanc – pen. $500.
    4. Fur coat. ($4500)
    5. Ferrari ($750,000)

    Well I”m not buying that stuff. Way tooo expensive! So I cross them off and remove them from the list and I add in:

    1. 12 dozen Titleist golf balls.

    The ObservableCollection

    So I come home and my friend is not pleased. But that was in the old days, now he’s got onto this whole smart phone thing – and he now has an Iphone with an IShoppingList app that’s on the cloud. Here’s how it works: whenever you remove something from the online shopping list on the cloud: he gets a notification on his phone (i.e. an sms or email etc) and in addition to that stuff happens. What happens exactly? Usually a phone call asking me to put the stuff back on the list.

    The observable collection works just the same way. If you add or remove something to or from it: someone is notified. And when they are notified, they do stuff. What stuff exactly? Well whatever you want! they can sing, dance, do the hokey-pokey etc.

    That sums it all up!

  • The difference between Synchronous and Asynchronous Execution

    Synchronous Execution

    My boss is a busy man. He tells me to write the code. I tell him: Fine. I get started and he’s watching me like a vulture, standing behind me, off my shoulder. I’m like “Dude, WTF: why don’t you go and do something while I finish this?”

    he’s like: “No, I”m waiting right here till you finish it off”. This is synchronous

    Asynchronous Execution

    The boss tells me to do it, and rather that waiting right there for my work, the boss goes off and does other tasks. When I finish my job I simply report to my boss and say: “I’m DONE!” This is Asynchronous Execution.

    …….it really boils down to something as simple as that!

  • Getting a Selection Set

    This is a code block from my award winning BlockUtility static class.. But you would want to create the selectionFilter according to your own requirements – hence I have not used a static class for getting the selection filter. Apologies for the lack of readability in my code. The blog just kills the formatting.

    What do we want to do?

    1. We want to prompt the user to select some objects on the screen.
    2. And we want to select only certain objects using a selection filter and
    3. we want to place all the filtered objects in a selection set.

    And Viola! You now have your selection set which you can use to further read and manipulate Autocad objects!

  • Showing an Assembly in the Model via a Tekla Drawing (Part I) – Tekla Open API Plugin

    I’ve created another Tekla plug in. And I’m calling it using a macro.

    What does this plug in do?

    Here is a demo:

    Basically it display an assembly in the model, from a given assembly drawing. Does that make sense? Well if not let’s elaborate:

    The Problem:

    I’m sure you’ll be having similar issues. So I’m working in Tekla. I’m busting my brains on this model that we’re working on, the boss is on my back like a monkey, and to add to all of that, I’m looking at an assembly drawing, but I have no idea how the actual drawing looks in real life. Can you make any sense of this?

    Can you make sense of this drawing? How does it look in 3d?

    This is simply an assembly drawing. Can you imagine how it would look in real life, or in the model?

    I guess not. What you want to see is the assembly in the model space. Well prior to my plug in, there’s a lot of rigormorale in finally getting to and seeing the drawing. Now you just run the macro and BOOM you can see exactly what that assembly drawing is referring to. In this case it’s referring to this lovely assembly in the model.

    Saves a lot of time and effort, hey?

    Ahh the glorious power of knowing .net and the Tekla API. Makes life a lot easier. But the hard part is learning programming,  .net, Tekla and the Tekla API. I suppose just save yourself the trouble and hire someone who already knows how!

    Where is the code?

    Please click here to access the code associated with this post.

     

    Ben Koshy

  • Structural Drafting Services

    Bendigo-Ramp
    Pedestrian Ram at Bendigo Station

    Benefits of using us for your structural drafting requirements.

    1. Experts in structural detailing and drafting who understand the needs.
    2. 45 Draftees, who can turn around you work in short time.
    3. Experts in 2d and 3d Cad systems. You get well-structured cad files and PDF prints.
    4. Lower RFIs to you at execution stage since we will dig out most of the potential RFIs and details at drafting stage. you save a ton of time.
    5. Lower costs since you engage us only when you need us.

    With many years of experience in structural and precast panel drafting, we are experienced enough to analyze your sketches and translate that into a professional set of drawings.

    We will look into potential problem areas from simple sheet naming and numbering, to connection details where required.

    If you have not provided us with connection details, we will propose the run of the mill standard Australian connection detail which you can review and approve or markup saving you a ton of time.

    The main tool for Structural drafting is Autocad for us. We also use other flavors of cad systems like Draftsight, NanoCAD, Revit

    Our CAD skills are extremely good and set up the CAD in a very systematic way.

    Services Offered

    • Co ordination with Architects Drawings
    • Creation of member schedules
    • Connection details drafting
    • Sheet layouts and Summary of sheets
    • Conflict and clash checking
    • Cross checking with design criterion (Design Criterion to be provided by structural engineer)
    • Member load taking capacity  calculation if you give the loading condtions and support conditions.
    • Preparation of structural drawings from your design brief and sketches
    • Member placement in Architects model.
    • Standard checks for Precast Panels (Lifting, spinning. Corner reinforcements,  Dowel Pins, Castin plates, Non Load bearing panels, Ferrules), Panel breaks

    Deliverables:

    • Full set of pdf drawings
    • Full set of Autocad drawings
    • Member Schedule
    • Connection details
    • Panel break up (Initial, depending upon location – Melb, Sydney or Brisbane. Other states you please supply constraints)
    • Panel break up considering crane availability.
    • Rationalisation of Panel details to lower costs. (we will liase with Architect)
    • Please download Deliverables on IFA and IFC     STEEL DELIVERABLES

    Please note – Each item on the deliverables have to be covered by a purchase order. We can work also on an hourly rate basis.

    Please note we are not structural engineers. We provide these services to structural engineers.

  • Steel Detailing

    1. Trimble Connect model with PDF of Assembly and General Arrangement drawings overlaid.
    2. Erection plan drawings.
    3. Assembly Drawings.
    4. Part Drawings.
    5. NC1 files
    6. DXF files
    7. unwrap templates
    8. IFC model – after payments have cleared.
    9. Trimble Connect Model with GA and Assy drawings overlaid
    10. CAD files of Erection plan and Anchor bolt layouts.
    11. Total Station export of Anchor bolt locations.
    12. Reports
      • Material List
      • Assembly List
      • Part List
      • Assembly Part List
      • Purlin List – (Purlin Bundles)
      • Bridging List
      • Galvanizing List
      • Erection bolt ListBolt Summary
    If requested at quote stage 
    Delivery of following Items incur significant detailing cost.
    1. Advance Bill of material
    2. Weld Map Drawings
    3. Detailed notation of each Weld
    4. Custom Drawing Templates.