Anxiety and mental attitude to relief your pain

Probably more than 33% of people that feel to be anxious have just a problem with their attitude with the future.

If you have a though that own you and you cannot control you are likely to be anxious.

The main problem is not the though in your mind, the mind thinks always (specially the unconscious mind)…

The main problem is related to the fact you think to actions to solve the problem, not to the goals about that.

Example:

I left to my car in a place where parking is not allowed:

My mind starts with the following:

- what if it will be clamped

- if I’ll be late I will get a fine, hurry up (and then you get distracted on something more important )

- why I didn’t pay the ticket so now I will be more relaxed

- what somebody will damage my car because was close to the gate, out of the white lines

- did I locks the car

- etc…

Did you notice it? All this thoughts are about possible consequences and infinite scenarios your mind can imagine.

why you don’t use your mind on this way:

- Think to what is the best scenario and the worst one

- Create a clear pictures

- Define what are you goals, what will be advantageous for you or less painful at least

Example:

- best scenario: nothing will happen, end of the worries, a feeling of relax will pervade your mind

- worst scenario: I’ll pay X for the fine, does this will impact my life so much to spend 1 hour think to all the possibilities? No, so 1 min of thinking is enough … so go on

- goal: not paying the fine (in this case you might meet the officer clamping your car, at that time you should define an action plan; why? because when you are close to the issue you more visibility of the variables and what then decide the best  action with the minimum effort….)

 
 

As usual practice to reach  change… you are not a digital machine, you need to experience to get it

 
 

 
 


Please like this article if you found it useful, Mario

Databinding in XAML for newbies (like me)

I never worked before with XAML and WPF, so I am looking to master the fundamentals concepts as soon I can to avoid stopper on the project I am working on; if you are a newbie on MVVM and XAML is a good idea to be familiar with the inspiring concept behind the separation of concerns.

XAML is a markup language where that uses controls and panels. The controls can contain others controls without changing
the behaviour of the controls itself. What does it mean? It means the behaviour of what the parent control can do is kept whatever it contains; controls behaviours doesn’t change when we change the layout, with a clear separation of them. The hierarchical structure defines the so-called visual tree, made up of controls and panels; the latter to define the layout of the XAML view. To make possible this, we need to change the idea of how bind data to the Presentation layer, the link between the View and the Model is done through the Binding in the XAML file, defining where to bind the Model and what to bind (Property of the Business Objects for example). Defining a “signpost” where to place the data at runtime, it make possible to change the layout/view without writing specific code… this is separation of concerns

Ex

My view is a rectangle and in the middle I want to show the Name of an object of the type Person

My view is a ellipse and in the middle I want to show the Name of an object of the type Person

Defining things with signpost (Binding) make this easier whatever the View is at runtime:

The concepts of Binding together with the Visual Tree makes possible to define a DataContext that will be inherited in the visual tree by each controls in it; this is very powerful you can refer to the Model anywhere you want and plus there is no type checking at compile time; the advantage is that the View doesn’t care to know which Model is used at runtime, the Model needs only to expose the property with the name in the XAML


<Ellipse Fill=”{Binding Color}”></Ellipse>


<Rectangle Fill=”{Binding Color}”></Rectangle>

So never so again something like

textBox1.Text = MyObject.Prop1;

but

<TextBox Text=”{Binding Prop1}”></TextBox>

+

this.DataContext = MyObjects // of anytype having at least Prop1 in the property defintion…

A very good starting point I found on the web are:

NYC DevReady: MVVM Content

  Title Speaker Content Links
Session 1 Demystifying XAML: Achieving Your Moment Of Clarity Miguel Castro Video Recording
Presentation Slides
Demo Code
Session 2 Programming with MVVM – Part 1 Miguel Castro Video Recording
Presentation Slides
Demo Code
Session 3 Programming with MVVM – Part 2 Miguel Castro Video Recording
Presentation Slides
Demo Code
Session 4 How Using MVVM Saved My Butt and How Laziness Came Back To Bite Me Danilo Diaz Video Recording
Presentation Slides
Session 5 Leveraging MVVM Inside PRISM Seth Juarez Video Recording
Presentation Slides

I suggest spending some time watching the recording, it will save a lot of time and it will help you to put on track (the right one) from the beginning

In attachment a VS2010 example that shows a Binding example in a listbox defining a template, note the behaviour of the listbox doesn’t change even the listboxitem are quite complex…

The Model is given by the class NationsRepository : List<Nation>

All the magic happens here

In the code behind (but not only here) we define the DataContext, where the data comes from at runtime,

NationsRepository.NationsRepository nationsRepository = new NationsRepository.NationsRepository();
this.DataContext = nationsRepository.GetSomePersistenData();

The XAML where we define Layout using Controls and Panels; note the ListBox Items are defined as a complex control, but still the behaviour is the change, check the screenshots:


<ListBox ItemsSource="{Binding}" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel  Orientation="Horizontal" >
                        <Rectangle  Height="16" Width="16" Margin="1,1,1,1" Fill="Red"></Rectangle>
                        <Label Content="{Binding Name}" FontStyle="Italic"></Label>
                        <TextBox Text="{Binding Population, StringFormat=Population: {0:N}}" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

Ex:

You can click on the listbox items as expected)

You can click in the textbox in the listbox item

The power of NoW, an example

An interesting story happened this morning. We have the genral waste collection one time each 2 weeks, that means you cannot miss or you get in trouble for 2 weeks, when it’ss full…. In the last 2 months I am the only one that take care of the collection becasue the other flatmates are fucking lazy… yesterday evening I forgot to leave the bin of the gate, and this morning I woke up around half past six, just in time to put on quicly some cloctes and run out to place the bin on the street… Unfortunately yesterday evening I’ve been late so I didn’t feel klike to wake up, go down, bring the f**k bin out of the street etc… so here comes the interesting part.

I wished no to get out of the bed to bring the bin out and I wished to have the bin empty to avoid problems…

From the rational point of you the action to take would be:

  • wake-up fox
  • put some clothes on
  • bring the bin out
  • come back to sleep for 1h  more (I have to go to work later)

As I discussed in the previous post there is a better way to do thing, to take advantage of all the possibility the reality offers to who is able to be focused and specially without fear in his heart (you’ll understand later what I mean)

From the exotropic mind point of view:

  • Sync with the reality (using the feelings and concepts oh thankfulness, joy and love)
  • Think what you want (to stay in bed and things be sorted out)
  • See the best solution to come
  • Sleep for another hour

So what I did was the 2nd point …. for a couple of mins only, but I really wanted it (easy, it was very cold outside), then suddenly I heard the noise of the rubbish truck approaching and the worst thing happened to me in this situations, the fear  of doing the wrong thing, to have taken the bad (rational) choice toke me and what I did was act using only the rational side of myself.

The conclusion is the funniest part…. I ran out the  house with the pyjama and the  jacket only and… the bin was out of the gate;  can you see that?… reality found the best solution to my problem from my point of view… so another example that motivates my to go further this ideas and concepts (my lazy flatmate brought out the bin, but we didn’t talk at all about that yesterday)

So next week the life motive will be:

I choose to be joy, love and courage

I want to be joy, love and courage

I am to be joy, love and courage

I deserve to be joy, love and courage

I choose to be tolerant, love and unstoppable (this is  a very powerful statement)

I choose to be joy, single-minded and bliss

Remember: what you have in your mind and you heart drive your tomorrow, so be carefull what you do today,

is not the past to build your present….

Last note about my reaction: no fury to have waken up for nothing ( a common reaction for a lot of people) but just say thanks to the good faith who helped me and give me another good lesson

IS Control flow precedence constraints visually…

Did you ever played with the control flow precedence constraints in SSIS; there are so many combinations that could put you in troubles if you don’t have a good understanding of them…

 

A connector (a flow constraint between 2 tasks basically) can result in one of this 3 states:

Success, Failure and Completion.

Success requires that the precedence executable succeed, Failure requires that the precedence executable fail, and Completion indicates that the constrained executable should run regardless of whether the precedence task succeeds or fails. For more information, see Precedence Constraints.

To complicate (actually to give you more flexibility) you can use Expressions too, to define the state of the connectors

Ex

@NumberOfEmployee > 0 ==> EXECUTE TASK process invoices for the employees

means

we want to exec a task called process invoices for the employees only if the expression@NumberOfEmployee > 0 where the var @NumberOfEmployee could be evaluated in another task…

This gives the possibility to define dynamically the task flow in you package, so much for powerful than a static flow, if you think about it.

To give you more freedom, you can combine static Constraint with Expression using logical AND and OR.

Ex

The previous example makes more sense if the @NumberOfEmployee  has been evaluated or the data of the employees is valid, so we could do an AND with a hypothetical task Load Employee Data, if this Fails it doesn’t make sense to proceed so a

Success Load Employee Data AND @NumberOfEmployee > 0 ==> EXECUTE TASK process invoices for the employees

would be more robust in this scenario.

 

The official MSND define the True table of all this combinations between Constraint and Expressions in this way:

image

 

Easy Ninja

What I did is just create a package with some combinations of them and see what happens.

Let’s have a look…

image

It’s quite easy to understand .. I wtote down some combinations of Constraint and Expressions … the central is a script task that will just ends up in Success or Failure, so you can run the package and see it in action…

Success scenario

ExpressConstrSucc

Failure scenario

ExpressConstrFail

Now read again the The official MSND define the True table of all this possibility in this wayThumbs up

Link

The SSIS pkg: http://goo.gl/AtfMa

ps

You can consider now and expert of Boolean Algebra…