Getting VS 2008 & mysql to play nicely!

I love linq!

But getting mysql to place nicely isn’t so straight forward.   To get mysql running on .net 3.5 or 4.0 I had to do the following:

1.  Install the mysql .net connector
2.  Add the MySQL Data Provider line in the DbProviderFactories to your machine.config file:

<system.data>
    <DbProviderFactories>
        <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.1.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
</system.data>

(see here for more information)

3.  Restart Visual Studio
4.  Add your models and go nuts!

This Stack Overflow question helped

Good luck!

read more

Linq – Multiple Group By

This has been bugging me for a LONG time!

I’ve finally found an example of how to group by multiple values using LINQ:
IList doc_infos = new List();

doc_infos.Add(new doc_info { region = "UK", price = 100, currency = "US" });
doc_infos.Add(new doc_info { region = "US", price = 100, currency = "US" });

var docs = doc_infos.GroupBy(x => new { x.price, x.currency })
.Select(group => new { d = group.Key, Count = group.Count() });

For more examples, have a look here.

read more

mysql Table '' is marked as crashed and should be repaired

I had an interesting error message today!

mysql Table ” is marked as crashed and should be repaired

The solution was easy enough. Go to the directory of the database, type:
myisamchk *.MYI -s
This will check all tables. For those that need to be fixed:
myisamchk -r tbl_name

Source: http://dev.mysql.com/doc/refman/5.0/en/myisam-repair.html

Also this link went into a little more detail on why it happened and what you can do to minimse it happening again:
http://www.softwareprojects.com/resources/programming/t-how-to-fix-mysql-database-myisam-innodb-1634.html

Rock on!

read more

Is David W Fenton a Troll?

Seth Godin recently had a post on Trolls that struck a chord.

I recently had an annoying experience on Stackoverflow.  Specifically, it was in regard to an Access Question.

I won’t bore you with the details.  The short version is that a Mr. David W. Fenton has some very strong feelings as to what a Competent Developer should or should not do.

I can respect his passion for his job, but I have little time for someone so one eyed.  I’ll save my response for another day.  Let’s just say that his definition of “user friendly”, “mission critical”, “application off line” is WAY different to mine.

He down voted my answer, which surprised me to say the least.

So is David W Fenton a troll?  Based on Seth’s observations:

1. trolls will always be trolling

At the time of writing, his Stackoverflow profile says that he has down voted a surprising 266 times (with only 203 up votes)

2. critics rarely create

He has asked 0 questions and it seems his greatest claim to fame is several MS Access 2003 “applications” (Access 2003???)  If David is creating, I don’t know what it is…

3. they live in a tiny echo chamber, ignored by everyone except the trolled and the other trolls

I couldn’t see a blog on his website or much more information.  His twitter stream is just a mindless rant of fart jokes and Irritable Bowel Syndrome comments

4. professionals (that’s you) get paid to ignore them. It’s part of your job.

Well Seth, that is the hardest one!

Rock on!

read more

Hosting your own terrible Windows 7 Party!

OMFG!

I read this on Rick Seagle’s Blog

How weird?  This must be Design By Committee.

Apparently, hosting your own Windows 7 Party is normal, but you need to be shown how…

Have a look:

[youtube=http://www.youtube.com/watch?v=1cX4t5-YpHQ]

read more

Linq – not in

I’m doing some work with LINQ and outer joins.

I found a few links, but it wasn’t what I was looking for.

I then thought I’d try a different direction and found this!

NorthwindDataContext dc = new NorthwindDataContext();
dc.Log = Console.Out;
var query =
from c in dc.Customers
where !(from o in dc.Orders
select o.CustomerID)
.Contains(c.CustomerID)
select c;
foreach (var c in query) Console.WriteLine( c );

This is exactly what I was after! I thought I’d share the love and post a comment – but what? I have to register to post comments???

I would be a little more understanding if Marco Russo’s site used some generic, open authentication system. But he didn’t.

(If you want to know how easy it is to implement Twitter, Facebook, OpenID or other identification methods, IT Conversations recently did a podcast on how they overcame this problem.)

Rock on!

read more