DaveAmour 160 Mmmmmm beer Featured Poster

I've been studying TDD for a few years and read quite a few books but none that good to be honest. Can anyone recomend any good ones. I'm not interested in BDD but am keen on anything that tackles the many problems of mocking intrinsic MVC objects.

DaveAmour 160 Mmmmmm beer Featured Poster

Those 2 urls are not the same!

DaveAmour 160 Mmmmmm beer Featured Poster

If you just want to know if the site is up then doesn't the redirect tell you that the site is up?

DaveAmour 160 Mmmmmm beer Featured Poster

I like it

DaveAmour 160 Mmmmmm beer Featured Poster

Actually I once debugged a production server because we could not replicate the error. It only happended on production.

We had 8 servers in a farm so I just took one out the farm, installed pdb files, installed VS on the server, debugged, fixed the problem, reversed everything and put it back in the farm.

Rule are meant to be broken if there is a good enough reason!

DaveAmour 160 Mmmmmm beer Featured Poster

So did you have a copy of the code at all? What kind of code was it?

If you have a copy then you can debug on a dev machine. If you don't have a copy then how will you fix any errors even if you find them?

I feel I can help here but I need more information.

DaveAmour 160 Mmmmmm beer Featured Poster

Did they have Source Control?

overwraith commented: It would have been nice wouldn't it have been? +3
DaveAmour 160 Mmmmmm beer Featured Poster

PS PS - Try changing the 6 to higher values to give you different results.

DaveAmour 160 Mmmmmm beer Featured Poster

PS - Here is a solution in C# - I am sure you can translate it!

void Main()
{
    for (int i = 6; i  > 0; i--)
    {           
        for (int j = 1; j  < i; j++)
        {
            Console.Write(j);
        }

        Console.WriteLine(i);
    }
}
DaveAmour 160 Mmmmmm beer Featured Poster

When you first enter the outer loop i is equal to 6. You then start the inner loop with j initially being equal to 1. You tell the inner loop to keep going while j is less than or equal to i. With each pass of the loop you subtract 1 from j so j starts at 1 then goes 0, -1, -2 etc so j is always less than i so the loop will never end until something crashes or your numbers flip (not sure how Java handles this as I am not a Java programmer).

DaveAmour 160 Mmmmmm beer Featured Poster

If you make then Date objects can you not use comparison operators - eg >, < etc?

DaveAmour 160 Mmmmmm beer Featured Poster

NaN means not a number.

Solve this by showing us your code and we can then show you how to fix it.

DaveAmour 160 Mmmmmm beer Featured Poster

Ok my apologies just ignore me then.

DaveAmour 160 Mmmmmm beer Featured Poster

If you click on Connect you get a list of options. Some of those will ask for your email but "Friend" doesn't.

How to find profiles - many ways, could be just someone who viewed your profile, or a connection of a connection or there are various search facilities.

I like your new site, I'm not critisizing it, I was just correcting you about how you thought you can connect with people on LinkedIn.

DaveAmour 160 Mmmmmm beer Featured Poster

You can actually connect with anyone on LinkedIn by just ticking the button to say you are their friend!

DaveAmour 160 Mmmmmm beer Featured Poster

They are the patterns you use to select elements eg:

p
{
    color: red;
}

This makes all paragraphs red - the "p" is the selector

Or:

.active
{
    border: 1px solid red;
}

The selector is ".active" which selects all elements with a class of active

DaveAmour 160 Mmmmmm beer Featured Poster

No problem, always happy to help.

DaveAmour 160 Mmmmmm beer Featured Poster

Like it

DaveAmour 160 Mmmmmm beer Featured Poster

Are they all trying to use the same port(s)?

DaveAmour 160 Mmmmmm beer Featured Poster

` var input = "BB5 6BN, BB4 6BN,BB4 8BN, CF10 3BA";

var trimmedInput = input.Replace(", ", ",");`
DaveAmour 160 Mmmmmm beer Featured Poster

Really sorry - still uber busy!

DaveAmour 160 Mmmmmm beer Featured Poster

Top Tip - look at T4MVC

@Html.ActionLink("Delete Dinner", "Delete", "Dinners", new { id = Model.DinnerID }, null)

T4MVC lets you write

@Html.ActionLink("Delete Dinner", MVC.Dinners.Delete(Model.DinnerID))

https://github.com/T4MVC/T4MVC
https://visualstudiogallery.msdn.microsoft.com/8d820b76-9fc4-429f-a95f-e68ed7d3111a

DaveAmour 160 Mmmmmm beer Featured Poster

Sorry real busy on my new contract. Will definatley have a look at the weekend at the latest!

DaveAmour 160 Mmmmmm beer Featured Poster

Fiddler is your friend here. Could be cookies, or header related. Look at a normal logon in fiddler and compare it with yours. http://www.telerik.com/fiddler

DaveAmour 160 Mmmmmm beer Featured Poster

Hi

Sorry mean to look at this yesterday but got tied up - will have a tinker tonight.

DaveAmour 160 Mmmmmm beer Featured Poster

I'm happy to look at scenarios with you. Can you ceate some actual tables though and show me the SQL to create them then we can be aure we are looking at the right thing.

DaveAmour 160 Mmmmmm beer Featured Poster

At a high level you need to provide a mechanism for client code to specify what it wants loaded.

Ef with Linq does this as follows:

var customers = context.Customers.ToList();

var customers = context.Customers.Include("Invoices").ToList()

var customers = context.Customers.Include("Invoices.InvoiceLines").ToList()

So the first says load just customers, the second says load customers and invoices and the last says load customers, invoices and invoicelines.

The above usually uses lambdas rather than strings so:

var customers = context.Customers.Include(c => c.Invoices).ToList()

and so on.

So in your code you need to examine the client specification and when building your sql add joins as appropriate to get the data you need. You then need to parse the resuls from SQL and create OO objects from the flat data.

Thats is really at a very high level. Of course it is more tricky in practice but that's the general idea I think.

DaveAmour 160 Mmmmmm beer Featured Poster

Let me have a think - working today but will post some thoughts at the weekend.

DaveAmour 160 Mmmmmm beer Featured Poster

It uses an algorithm to conver linq to sql with joins.

I think you can get the code from https://github.com/aspnet/EntityFramework

DaveAmour 160 Mmmmmm beer Featured Poster

All deferred means is that you can keep adding to the query - adding extra where clauses etc but not until the point in time when the query is enumerated will EF create the SQL and execute it against the database in one go.

DaveAmour 160 Mmmmmm beer Featured Poster

No what I mentioned was eager loading - ie exactly what you need.

.Include tells the ORM what to include - ie which joins to generate in SQL server. It only does one database hit. It does this using deferred execution - ie the first time the data is enumerated.

DaveAmour 160 Mmmmmm beer Featured Poster

It does matter which ORM it is - is it hand made - are you able to add to it or does it have any extension points or is it set in stone?

EF uses .Include with deferred execution, that works well - maybe you can emulate that - depends on the ORM though!

DaveAmour 160 Mmmmmm beer Featured Poster

Which ORM is this?

DaveAmour 160 Mmmmmm beer Featured Poster

Can you do the loop step 2? Would be more efficient.

DaveAmour 160 Mmmmmm beer Featured Poster

Have a look at T4MVC and @Url.Action

DaveAmour 160 Mmmmmm beer Featured Poster

Some more tinkerings - might also help.

Look at the DoSomething methods. In OO you shouldn't be asking if something is of a certain type and then acting accordingly, much better to use polymorphism as in the DoSomething Example.

void Main()
{
    var game = new Game();

    Player dave = new Player { Name = "Dave" };
    Player sarah = new Player { Name = "Sarah" };
    Computer mac = new Computer { Name = "Mac" };

    game.PlayerList.Add(dave);
    game.PlayerList.Add(sarah);
    game.PlayerList.Add(mac);

    foreach (var player in game.PlayerList)
    {
        Console.WriteLine(player.Name + " is a computer = " + (player.GetType() == typeof(Computer)));
    }

    Console.WriteLine();

    bool isCurrentPlayerComputer;

    game.CurrentPlayer = mac;   
    isCurrentPlayerComputer =  game.CurrentPlayer as Computer != null;  
    Console.WriteLine("Current Player {0} is a computer? {1}", game.CurrentPlayer.Name, isCurrentPlayerComputer);

    game.CurrentPlayer = dave;  
    isCurrentPlayerComputer =  game.CurrentPlayer as Computer != null;  
    Console.WriteLine("Current Player {0} is a computer? {1}", game.CurrentPlayer.Name, isCurrentPlayerComputer);

    Console.WriteLine();

    foreach (var player in game.PlayerList)
    {
        player.DoSomething();
    }   
}

public class Game
{
    public Game()
    {
        PlayerList = new List<Player>();
    }

    public List<Player> PlayerList { get; set; }

    public Player CurrentPlayer { get; set; }
}

public class Player
{
    public string Name { get; set; }

    public virtual void DoSomething()
    {
        Console.WriteLine("Doing something in the style of a player");
    }
}

public class Computer: Player
{
    public override void DoSomething()
    {
        Console.WriteLine("Doing something in the style of a computer");
    }
}
DaveAmour 160 Mmmmmm beer Featured Poster

I'm not really sure what you are after but I did some tinkering - might help, might not.

void Main()
{
    var game = new Game();

    Player dave = new Player { Name = "Dave" };
    Player sarah = new Player { Name = "Sarah" };
    Computer mac = new Computer { Name = "Mac" };

    game.PlayerList.Add(dave);
    game.PlayerList.Add(sarah);
    game.PlayerList.Add(mac);

    foreach (var player in game.PlayerList)
    {
        Console.WriteLine(player.Name + " is a computer = " + (player.GetType() == typeof(Computer)));
    }
}

public class Game
{
    public Game()
    {
        PlayerList = new List<Player>();
    }

    public List<Player> PlayerList { get; set; }

    public Player CurrentPlayer { get; set; }
}

public class Player
{
    public string Name { get; set; }
}

public class Computer: Player
{

}
DaveAmour 160 Mmmmmm beer Featured Poster
public class MyModel
{
    public Model1 Model1 { get; set;}
    public Model2 Model2 { get; set;}
}
DaveAmour 160 Mmmmmm beer Featured Poster

Yes. What do you want to be in the strings though - one specific property of the objects, or there ToString representation?

Here are some examples:

void Main()
{
    List<Person> people = new List<Person>
    {
        new Person { Firstname = "Dave", Surname = "Amour", Age = 48 },
        new Person { Firstname = "Fred", Surname = "Smith", Age = 21 },
        new Person { Firstname = "Sarah", Surname = "Greene", Age = 34 },
        new Person { Firstname = "Louise", Surname = "Atkins", Age = 41 }
    };

    var stringArrayOfFirstnames = people.Select(p => p.Firstname).ToArray();
    var stringArrayOfSurnames = people.Select(p => p.Surname).ToArray();
    var stringArrayOfFullnames = people.Select(p => p.Firstname + " " + p.Surname).ToArray();

    var stringArrayOfToString = people.Select(p => p.ToString()).ToArray();
}

public class Person
{
    public string Firstname { get; set; }
    public string Surname { get; set; }
    public int Age { get; set; }

    public override string ToString()
    {
        return Firstname + " " + Surname + "(Aged " + Age + ")";
    }
}
DaveAmour 160 Mmmmmm beer Featured Poster

I was thinking alot about this post and had already come to the same conclusion as gusano79 so just adding my support for his answer, you are definatley misusing generics.

DaveAmour 160 Mmmmmm beer Featured Poster

Look at the code that hashed them in the first place.

irshad398 commented: I don't have that code now. I have only database stored. +0
DaveAmour 160 Mmmmmm beer Featured Poster

Also depends if you are talking asp.net webforms or asp.net mvc.

DaveAmour 160 Mmmmmm beer Featured Poster

Can you show us EWapper? Is that an interface? If so click on it above and hit Ctrl period.

If it is an interface, then its a convention to name then with an I - eg IEwrapper

DaveAmour 160 Mmmmmm beer Featured Poster
DaveAmour 160 Mmmmmm beer Featured Poster

You need to look at server side web technologies/languages.

DaniWeb for example is written in PHP and that is a good choice for MySQL.

You can also look at Asp.net WebForms or Asp.net MVC

There are many others: http://www.sitepoint.com/server-side-language-right/

DaveAmour 160 Mmmmmm beer Featured Poster

Use an absolute network path?

DaveAmour 160 Mmmmmm beer Featured Poster

I'm a bit late here but the disk has to be the issue.

If you copy a file from one drive to another manually with explorer - eg a video file it will go at a certain rate. If you then copy 5 more at the same time, their speed will all drop. The bottleneck is the disk.

DaveAmour 160 Mmmmmm beer Featured Poster

Databases can generate their own unique keys. Any reason why you can't do this? Sounds like you are making hard work for yourself.

If you really do want to generate unique keys yourself though then try a Guid eg:

private static string GenerateScanID()
{
    return Guid.NewGuid().ToString();
}
DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome - and now you do know how to share something - this is often more efficient if you have data which doesn't change from instance to instance.

DaveAmour 160 Mmmmmm beer Featured Poster

I think bulk uploads look for files on the machine SQL is running on.