|
Just give him some pi and he'll stop.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
No, give him some pi and he'll take it as a sine to go round and round forever.
|
|
|
|
|
Yes, he's likely to take this to the nth degree.
/ravi
|
|
|
|
|
I knew you'd De Moivre out of this one as well.
|
|
|
|
|
Looks like we'll have to sec and destroy!
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
That's a nice hypotenuse you have there.
|
|
|
|
|
As long as the mistake I made isn't a reflex.
|
|
|
|
|
Perhaps I ought to supplement that with a compliment? Well, you can secant you that it's just not going to happen.
|
|
|
|
|
You seem to be going off on a hyperbola. Perhaps we need to deploy the cosh?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
e(h), with complex numbers?
|
|
|
|
|
He seems to be secant revolution points.
Software Zen: delete this;
|
|
|
|
|
I'd answer but I am on a tangent.
Mongo: Mongo only pawn... in game of life.
|
|
|
|
|
That could be an acute problem!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
I'm afraid this TotD is stuck in a circle.
... such stuff as dreams are made on
|
|
|
|
|
Nah. As usual, they're just talking sh1t.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
If the article includes only the upside of things, it's a haversine of the Times.
Will Rogers never met me.
|
|
|
|
|
|
Learned something new today. I was googling for CRC algorithms and came across this nifty site[^] and started perusing it more generally, then realized I had no idea about let clauses in query expressions![^]
Geez, I've been using LINQ for a while now, and didn't know about that.
Marc
|
|
|
|
|
Cool! I didn't know about it either. Now to find a use for it, just because
|
|
|
|
|
It's a useful tool in your arsenal. So how have you been solving this in the past? Multiple queries chained together?
Just wait until you start using "into[^]".
This space for rent
|
|
|
|
|
Pete O'Hanlon wrote: So how have you been solving this in the past? Multiple queries chained together?
My Linq tends to be rather simple.
Pete O'Hanlon wrote: Just wait until you start using "into[^]".
Though for reporting, yup, been there, done that:
var categoryRanks = (from gs in geekSkills
where (gs.ProfileId == profile.Id)
join s in skills on gs.SkillId equals s.Id
select new { Level = gs.Level, CategoryId = s.CategoryId } into gss
join c in categories on gss.CategoryId equals c.Id
select new { Level = gss.Level, Name = c.Name } into gssc
group gssc by new { gssc.Name, gssc.Level } into g
select new SkillLevelBySkillByCategory() {
SkillLevel = g.Key.Level,
SkillLevelCount = g.Count(x => x.Level == g.Key.Level),
Name = g.Key.Name });
Marc
|
|
|
|
|
Now, if your table have appropriately assigned foreign keys, then your Profile object would have a "geekSkills" collection of Skills object, which in turn would have a Category property which would have a Name property.
Reducing that to :
var categoryRanks = from s in profile.geekSkills
group s by new {Level = s.Level, Name = s.Category.Name} into g
select new SkillLevelBySkillByCategory() {
SkillLevel = g.Key.Level,
SkillLevelCount = g.Count(x => x.Level == g.Key.Level),
Name = g.Key.Name };
Not having the tables (or schema) makes designing that a bit tricky, so that might be off a bit. (like, i"m pretty sure that SkillLevelCount can be just "g.Count()" but I don't know your data)
Now, using LET, we can bring that down to :
var categoryRanks = from s in profile.geekSkills
let sl = new {Level = s.Level, Name = s.Category.Name}
group sl by sl into g
select new SkillLevelBySkillByCategory() {
SkillLevel = g.Key.Level,
SkillLevelCount = g.Count(x => x.Level == g.Key.Level),
Name = g.Key.Name };
Truth,
James
|
|
|
|
|
James Curran wrote: Now, if your table have appropriately assigned foreign keys,
They do, but I haven't set up my models yet with EntityRef and EntitySet. I'll have to do that and then play around with what you're suggesting.
I'll be really curious to log what the DataContext does!
And thank you for the reductions, that was way beyond the call of duty!
Marc
|
|
|
|
|
Marc Clifton wrote: They do, but I haven't set up my models yet with EntityRef and EntitySet.
That shouldn't be necessary. As long as the tables have the foreign keys defined, both Linq2sql & Entity Framework should create the properties automatically.
Truth,
James
|
|
|
|
|
I didn't know that and will probably forget quite soon too. Do people use that sort of syntax still? I never see it, and don't know what its called.
My inclination would be something hideous like this:
var a = strings.SelectMany(x => x.Split(' ')).Select(x => x.ToLower()).Where(x => x[0] == 'a' || x[0] == 'e' || x[0] == 'i' || x[0] == 'o' || x[0] == 'u');
...which I would call Linq, but may not be, or might be just some perverse form of it.
Regards,
Rob Philpott.
|
|
|
|