Monday, October 17, 2011

No reminder list App in OSX Lion but on iOS5 iPad and iPhone

With the latest IOS upgrade there was a simple but effective Reminders app for the iPad.


This can sync with iCloud and therefore be synced across all devices. But where is the app on the Mac?

It can be found in the Calendar app as shown below.



This will be shown in the Calendar app as:


Wednesday, October 12, 2011

Code first in Entity Framework database not being created

There are a few excelent resources on the web that help a great deal as tutorials for the Entity Framework but many are a version too old-ish.
If your connection string is correct, if the contact class and DbSet class code correct, and if the project has a reference to the correct version of EntityFramework, and the database is still not being created, here are a few pointers to look for.

(But, do look at the date of this post and versions as this will be out of date quite soon.)

One thing to look for:
If you think you have created the context class correctly, and web config strings, then close the ASP.NET development server icon in the icon tray. If this server is running, it seems that Code First will be prevented from creating a new database. There may be multiple instances of this server loaded. Simply STOP them down and then re-run your project. Then check the database.

Another thing to look for:
Check that CFCodefirst.1.1 is in the Packages folder. You will probably need to look of this in the file system at the root of the project / solution . Also check that it is entered in the packages.config file.
Something like:

<package id="EntityFramework" version="4.1.10331.0" />
<package id="EFCodeFirst" version="1.1" />

Make sure that you ask for some values from the database context. That is, use a property.
And, make sure the return value is correct. If the property fetch fails, you may not know about it. It'll fail and you'll get no data + you won't get your database made. I suggest you use:

var model = _db.DummyBooks;


Also,
If you have the data code in its own project, for some kind of layering. Then beware of giving the Entities the same name as other Domain objects. I know this is vague advice, but if you name the Entitiy something like Customer, and if there is a Domain object called Customer, then the Code First might get confused and fail to create the database. It often does this without telling you why.

If all else fails,
Sometime Visual Studio and the SQL Server Management Studio just seem to play up. They say the database isn't there, sometimes it's not. Sometimes putting a breakpoint after the call to the Context property seems to work. It seems random. But, if you go step by step, from the simplest to adding more and more complexity, shutting down VS and the db connection, progress can be had.
I'm sure this nightmare doesn't always happen. As yet I don't know what causes it.

Saturday, October 8, 2011

What really is Agile development anyway

I want to write my thoughts, maybe slightly random though they are, whilst I think about it. This isn't a well researched article, or in fact an article at all. It serves only as an outlet for my thoughts and mild frustration.

Firstly I should say that I am definitely PRO the use of Agile, and definitely PRO the use of SCRUM. I am also VERY much PRO AGILE, without total SCRUM. You'll see what I mean:

I have recently been looking at the job-boards as I decided it was time to move. Now, along with the usual technology buzzwords on the buzzword list, is the now almost ubiquitous requirement for Agile, or SCRUM, and slightly less so, Kanban or XP.
It seems that every job wants Agile. That's pretty good but what do they want and what does it mean?

Some companies I guess are very serious. They are prescriptive and formal with SCRUM. For those it can be applied to everything - ordering the coffee or creating their next geo-stationary satellite. Others are just 'kind of' in the space. They like bits of it, do bits of it, and are doing ok. How do you apply this SCRUM thing to the web-site dev team or perhaps the team doing the cargo shipping management system. The teams have different cultures and dynamics, different feelings, perhaps a different attitude to their trade.

I'm not sure a lot of people know what they are talking about when they talk about Agile. For me, Agile is a general set of ideas that benefit and tend to create successful software projects. I think that Agile is a type of thinking.

A place to start is the Agile manifesto. I'm sure this site will change over time, I hope so, but my first feeling when seeing this is not a good one. Before I even get to the merits of the text and the list of luminaries in the list of Authors, I'm thinking what a hideous thing to look at. I'm also thinking that it has a  bit of a self-righteous feel to it. The Principles is where you should end up really. That's the meat and veg of the site. Forget that it looks like a prayer for some religious order.

The Principles behind the Manifesto 
We follow these principles: 
Our highest priority is to satisfy the customer through early and continuous deliveryof valuable software. 
Welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage. 
Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale. 
Business people and developers must work together daily throughout the project. 
Build projects around motivated individuals.  Give them the environment and support they need, and trust them to get the job done. 
The most efficient and effective method of conveying information to and within a development team is face-to-face conversation. 
Working software is the primary measure of progress. 
Agile processes promote sustainable development.  The sponsors, developers, and users should be able to maintain a constant pace indefinitely. 
Continuous attention to technical excellence and good design enhances agility. 
Simplicity--the art of maximizing the amount of work not done--is essential. 
The best architectures, requirements, and designs emerge from self-organizing teams. 
At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.
Link to the manifesto

This is the heart of it all. This for me, after years of fiddling with projects, is not only the fashionable thinking of our time, but it's the best chance of success.

What about SCRUM, DSDM...? Well for me, these are not what Agile is about. They are ways of playing at Agile for sure, but they're not what Agile is? For me, in a sense, they take away some of the agile ethos, yet they do deliver good projects. I'll explain.

Objectives of Agile
I think that the objectives of Agile are things like quick thinking, quick reactions, the stuff in the principles. It is about getting the right stuff done for the client and knowing that all of us, clients and project producers, will constantly be making mistakes in our understanding and communication.

Methods of being Agile
I think the SCRUM, the XP and the DSDMs of this world are the methods, the prescribed and prescriptive methods to go from the tools and techniques to the result. The result is the product developed by using the objectives.

Techniques for using in our pursuance of Agile
The tools - well I think they're things like TDD, Unit testing, User stories, DDD.

I think the three previous sections are a bit general and debatable, and probably a bit wrong. In a few weeks, if I review what I have written here. I may well change it but I think the principle is correct.

People say that the Agile thing started around '86 when Scrum was first mooted. I don't think it was used then though. It was much later.
I remember using DSDM in the late '90s, and then XP. I'm sure I didn't hear the term Agile though. One day it suddenly became very trendy to talk about Agile. It was an invented term to group these new ways to develop software. Kanban arrived in 2004, a few years before that the manifesto was created.


At one end of the Agile spectrum is the philosophical, the cultural aspect of developing software. At the other end is where the philosophical approach has been distilled and implemented with tools to become a prescriptive process. The prescribed process is something losing it's free spirit. Sounds a bit hippy, but the free spirit is dangerous. In the hands of the careless it is another lost project. In the hands of the lazy its an excuse. That is why we need SCRUM. SCRUM is therefore good. A force for good but it is not, in itself, the thing that is AGILE.

Monday, October 3, 2011

The Five Dysfunctions of a Team - Patrick Lencioni


A QUICK OVERVIEW OF THE MODEL

As difficult as teamwork can be to achieve, it is not complicated. And so, if I can't describe it in a page or two, then I've probably made it too complex. Here goes.
The true measure of a team is that it accomplishes the results that it sets out to achieve. To do that on a consistent, ongoing basis, a team must overcome the five dysfunctions listed here by embodying the behaviors described for each one.
  • Dysfunction #1: Absence of Trust: Members of great teams trust one another on a fundamental, emotional level, and they are comfortable being vulnerable with each other about their weaknesses, mistakes, fears, and behaviors. They get to a point where they can be completely open with one another, without filters. This is essential because ...
  • Dysfunction #2: Fear of Conflict: ... teams that trust one another (they have #1 above) are not afraid to engage in passionate dialogue around issues and decisions that are key to the organization's success. They do not hesitate to disagree with, challenge, and question one another, all in the spirit of finding the best answers, discovering the truth, and making great decisions. This is important because ...
  • Dysfunction #3: Lack of Commitment... teams that engage in unfiltered conflict (they have #2 above) are able to achieve genuine buy-in around important decisions, even when various members of the team initially disagree. That's because they ensure that all opinions and ideas are put on the table and considered, giving confidence to team members that no stone has been left unturned. This is critical because ...
  • Dysfunction #4: Avoidance of Accountability: ... teams that commit to decisions and standards of performance (they have #3 above) do not hesitate to hold one another accountable for adhering to those decisions and standards. What is more, they don't rely on the team leader as the primary source of accountability, they go directly to their peers. This matters because ...
  • Dysfunction #5: Inattention to Results: ... teams that trust one another, engage in conflict, commit to decisions, and hold one another accountable (they have #4 above) are very likely to set aside their individual needs and agendas and focus almost exclusively on what is best for the team. They do not give in to the temptation to place their departments, career aspirations, or ego-driven status ahead of the collective results that define team success.


I dislike the book really. Probably because  I'm too lazy to read it. The above snippet is in Chaper 42. In Chapter 43 there's a team assessment thing.

Saturday, October 1, 2011

Modulus of a Complex number

For, z = a + bi , the modulus is
|z| = sqrt(a^2 + b^2)

e.g, 
z = (1 + 2i)^2
z = (1 + 2i) . (1 + 2i)
  = 1 + 2i + 2i + 4i^2    (remember that, i^2 = -1 )
  = 1 + 4i + 4(-1)
  = -3 + 4i


|z| = sqrt( -3^2 + 4^2)
    = sqrt(9 + 16)
    = sqrt(25)
|z| = 5



A bit more on Complex numbers



We know that, 
i = sqrt (-1)

and therfore, 
i^2 = -1


Also, sqrt (9) = 3

 sqrt (-9) = sqrt(-1).sqrt(9) = i.sqrt(9) = 3i
We can check this. 
(3i)^2 = 3^2.i^2 = 9.-1 = -9

So, 
(3i)^2 = -9
3i = sqrt(-9)

3i is an imaginary number.

Complex number are imaginary and real numbers together.
e.g.

6 + 3i is a complex number.

Addition of complex numbers 
Here we have two complex numbers zi and z2

zi = a + bi
z2 = c + di
we add the real parts then add the imaginary parts.

zi + z2 = (a + c) + (bi + di)
        = (a + c) + (b + d)i

Subtraction of complex numbers 
Here we have two complex numbers zi and z2
zi = a + bi
z2 = c + di
we subtract the real parts then subtract the imaginary parts.
zi - z2 = (a - c) + (bi - di)
        = (a - c) + (b - d)i

Multiplication of complex numbers 
Again we have two complex numbers zi and z2
zi = a + bi
z2 = c + di

zi . z2 = (a + bi) . (c + di)
        = a(c+di) + bi(c+di)
        = ac+adi + cbi + (bi.di)          ....... (eqn 1)
let's sort out the (bi.di)
(bi.di) = bd.i^2
we know that i^2 = -1
so, db.i^2 = -bd
Returning to where we were in eqn (1),
zi . z2 = ac + adi + cbi - (bi.di)
        = ac + adi + cbi - bd
        = (ac - bd) + (adi + cbi)
        = (ac - bd) + (ad + cb).i



Division of complex numbers 
Again we have two complex numbers zi and z2
zi = a + bi
z2 = c + di

zi / z2 = (a+bi)/(c+di)

We can use the rule:
(a+b).(a-b) = a^2-b^2

The Conjugate of a complex number is a reverse of the direction of the imaginary number.
The Conjugate of (a + bi)is (a - bi)
The Conjugate is written with a bar over the top, so the conjugate of z1 is written z1 bar. 
How do I type that here? I don't know!

When we multiply an imaginary number by its conjugate we get a Real number. Here's the trick:

zi     (a+bi)   c-di   ac-adi + bci-bdi^2
--- =  ------ . ---- = -------------------
z2     (c+di)   c-di   c^2 + d^2

      ac-adi + bci-bdi^2         [remember that , i^2 = -1]
    = ------------------- 
         c^2 + d^2


      ac-adi + bci+bd
    = ----------------- 
         c^2 + d^2

       (ac+bd) + (bc-ad)i
    = --------------------- 
         c^2 + d^2

       ac+bd         bc-ad
    =  --------  +  ------- . i
       c^2+d^2      c^2+d^2


example.

1+2i    (1+2i)   2-3i   (1.2) + (1.(-3i)) + (2.2i) + (2i.(-3i))

---- =  ------ . ---- = ---------------------------------------
2+3i    (2+3i)   2-3i   (2.2) + (2.(-3i) + (3i.(2) + (3i.(-3i))

       2 - 3i + 4i - 6i^2
     = ------------------
       4 - 6i + 6i + 9i^2


        2 - 3i + 4i + 6

     =  ------------------
             4 + 9
     
        8 + i
     =  -----
         13  
     
     =  8      1
       ---  + --- i     
       13     13





Basic imaginary numbers from definition

i^0  = 1
i^1 = i
i^2 = -1
i^3 = -i
i^4 = 1


i^5  = i
i^6 = -1
i^7 = -i
i^8 = 1
i^9 = i

e.g.
So, i^ 325 = ?
325/4 = 8 remainder 1
( note 1 is the modulus)
same as i^1 = i

Remember, i = sqrt( -1 )

OK, a little bit More
I should really quickly note the definition:

We know that, 
i = sqrt -1
and therefore
i^2 = -1


therefore,
i^1 = i    [ anything to the power of 1 is itself ]
i^2 = -1   [ given above ]
i^3 = i^2.i^1 = -1.i = -i   
i^4 = i^3.i^2.i^1 = -i.-1.i = 1




A bit more on complex numbers