|
Liagapi wrote: vary independently from clients That's the point: in your case, a Circle requires the algorithm for a circle, not for a rectangle, etc.: the algorithm absolutely depends on the client.
Think of something different, say a chess game. How to find out the next move? You could use "brute force" calculating a few moves ahead, or you could implement some "artificial intelligence strategy". There could be external constraints, e.g. how much time you may use for calculating the next move, and hence apply different algorithms with different trade-offs.
Select the algorithm applicable for the current scenario - and with the next scenario use an algorithm for that scenario.
|
|
|
|
|
My first impulse would have been to use polymorphism:
Polymorphism (C# Programming Guide)
(The example looks very familiar).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I have a SQL table with a Started column that is of type DateTimeOffset.
In a Linq To Entities query I'm trying to query against a DateTime value:
.
.
.
where t.Started.Value.DateTime >= startDT
.
.
.
I get "The specified type member 'DateTime' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."
I've never used a DateTimeOffset. What's the right way to query this field using Linq To Entities?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
There are many things you can't do with L2E - sadly, this is one of them. What you need to do is materialize the data into something like a list first, and then apply the filtering to the list.
This space for rent
|
|
|
|
|
Pete O'Hanlon wrote: What you need to do is materialize the data into something like a list first
I thought of that, but what this means is first querying the ENTIRE table into a list, then applying the date check. This obviously won't work.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Turns out that it works with Linq To SQL, but not Linq To Entities.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I know - that's why I said this is one of the things you can't do with L2E.
This space for rent
|
|
|
|
|
ya, no big deal. I'm just getting started to converting isn't an issue.
Thanks for the heads up.. Save me hours of Googling & fiddling.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
How about:
where t.Started >= startDT
The implicit cast from DateTime to DateTimeOffset will let the C# compile, and the L2E query should just work.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I would have to know what the offset is that I'm looking for, then add that to the DateTime I'm using as my paramater
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
So you want the rows where the local value of the DateTimeOffset is after a particular DateTime value?
Seems a bit strange to me, but you should be able to do something like this:
int startYear = startDT.Year;
int startMonth = startDT.Month;
int startDay = startDT.Day;
int startHour = startDT.Hour;
int startMinute = startDT.Minute;
int startSecond = startDT.Second;
...
where t.Started >= EntityFunctions.CreateDateTimeOffset(
startYear, startMonth, startDay, startHour, startMinute, startSecond,
SqlFunctions.DatePart("tz", t.Started))
...
EntityFunctions is defined in System.Data.Entity.Core.Objects in the EntityFramework assembly;
SqlFunctions is defined in System.Data.Entity.SqlServer in the EntityFramework.SqlServer assembly.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Good evening everyone I'm looking on google but I do not find a solution that allows me to display the checkbox check in datagridview in a line specify. The display should not be vertical as the result in this image.
|
|
|
|
|
|
How can I implement NLP in c# program? Is there any logic for extracting single/multiple words from one or more sentences?
For more understandability, I included a paragraph(Doctor's Note) here.
The patient x is suffering from fever. He has no headache, cough or neck pain. But he has back pain.
Moreover patient x suffers Sleeplessness.
<big>My requirement is</big>,
I need to iterate symptoms such as <big>fever, back pain and sleeplessness</big>. And
do not take symptoms <big>headache, cough and back pain</big> .
|
|
|
|
|
|
There is no package yet that can guarantee correctness. Unless the doctors adhere to a specific syntax you'll run into weird phrases.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hey volks,
I would accomplish the following scenario:
I have a C# Application, it hast registered OS-Extension (*.fpf) and comes as ClickOnce.
Now i would have the ability to save variables into a "project-file" that is saved somewhere on the system and if i doubleclick the C# application starts and read the stuff of the project-file.
Any idea how to solve this is welcome...
Thanks in advance,
Matthias
|
|
|
|
|
Member 11045388 wrote: Now i would have the ability to save variables into a "project-file" that is saved somewhere on the system and if i doubleclick the C# application starts and read the stuff of the project-file. You register a new file type. See MSDN[^], or here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
well, that is done so far, i registered a extension for my app and when i open the associated file (which contains strings (with line breaks) the application open correctly. What i don't know is how to use the text part inside the app now. When i use filestreamreader - how do i say how to use the lines of the file (the one that i double-clicked) ....
any Idea how to do this?
|
|
|
|
|
Unless you expect your file to be yuuge, you probably don't need a streamreader. File.ReadAllText would do, and that would return a string. Split it on characters #10 and #13 (CR LF) and you'll have an array of lines.
You'll have to "find" the appropriate entry by looking at those strings.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks - that is ok for me, all i need to know is how to use the file that i double-clicked. That is not clear to me ... the app start when i double-click on it, but how can i access the textfile (what is needed that the app knows it is opened by a textfile and parse the values). I read actual about
Environment.GetCommandLineArgs(); but unfortunately it seems to be empty 
|
|
|
|
|
I'd prefer to get the command-line arguments as passed into the main-method[^], but it should yield the same result.
It is an array of which the first item may be empty. If no arguments are supplied at all, then you probably did not register the correct command to launch the application. Did you include a "%1" in the command-line as registered to launch the application?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i found my error. The extension does not open with my exe file. Instead it opens with the ClickOnce Handler .... now i have to find out how to change this
When doing it right i get the filename and path that opens my app so i can continue from here i think.
Thanks for everybody!
|
|
|
|
|
Or let the system do it for you with File.ReadAllLines
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Lines! You're right!
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|