15,742,357 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Javascript questions
View C++ questions
View Python questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by csrss (Top 58 by date)
csrss
22-Jun-21 11:46am
View
Thanks very much!
csrss
22-Jun-21 11:33am
View
Thanks. This is something what I need. I have tested first_value - is there any difference between them?
csrss
22-Jun-21 11:17am
View
Updated question. Yes, forgot about it. No, it's for me. It is not a table what I am scanning. It is already a result of a query, so I cannot run it multiple times, or insert stuff in temp table - production result contain millions of records.
csrss
22-Jun-21 11:13am
View
1 table scan allowed.
csrss
22-Jun-21 9:42am
View
Thsi table here is just an example. Actual table has more data. And return format is very important.
csrss
10-Jun-21 4:15am
View
Thanks for the explanation! I'll look into this later.
csrss
10-Jun-21 2:24am
View
Is there a solution without using 'OR' maybe?
csrss
10-Jun-21 2:17am
View
I am just considered about using 'OR' in this solution. As I have mentioned, OR is very slow.
csrss
7-Jun-21 2:36am
View
Thanks! This helped, I had to adjust it to my needs of course but this is it :)
csrss
7-Jun-21 2:17am
View
Thanks. Will try that out
csrss
4-Jun-21 9:20am
View
Thanks
csrss
27-Feb-21 15:07pm
View
Thx :)
csrss
27-Feb-21 14:27pm
View
Thx!
csrss
3-Dec-20 11:53am
View
Unfortunately, this does not work
csrss
3-Dec-20 6:10am
View
So far, this is the most relevant answer. However, I did that already, and though that there is an easy way, like with model binding. I'll probably stick to my current solution. Thanks anyway
csrss
2-Dec-20 17:14pm
View
I dont really see how this can help
csrss
2-Dec-20 15:26pm
View
Well, I am not asking for an advice what route should I take, right?
Maybe creating such attributes is not possible and there are just built-ins.
csrss
2-Dec-20 15:16pm
View
Only for controller method
csrss
2-Dec-20 15:09pm
View
Anything, extraction of user role, auth token, any sort of information, required to run an endpoint.
csrss
2-Dec-20 14:45pm
View
The question is correct I think, because [FromBody] is an attribute, but it is some sort of built-in attribute. I am already doing it like it is show on the link you provided, like this:
[ModelBinder(typeof(MyModelBinder))] MyClass myClass
But it feels that it can be done better, something like this:
[FromRequest]MyClass myClass
And this is what I am asking about, how to do it.
csrss
2-Dec-20 14:34pm
View
But even if it is what I am looking for, how can I get HttpContext, how can I set output parameters, etc - there is no information in this link you posted. I dont see, how can I extract data from HttpRequest and pass it up as a Controller parameter.
csrss
2-Dec-20 14:22pm
View
But this is something completely different
csrss
26-Nov-20 6:28am
View
Thanks. I'll have a read.
csrss
26-Nov-20 5:38am
View
Yes, I have checked. The only thing which is odd to me, is:
1. In AspNetRoles there is a column Discriminator which is set to "Role"
2. In AspNetUserRoles there is a same column Discriminator which is set to "IdentityUserRole<string>".
Maybe because of this it is failing. Anyways, I have used different design where joining Collection<identityuserrole<string>> to user is sufficient, so I just leave it like this for now.
csrss
26-Nov-20 5:28am
View
Nope, this does not work.
csrss
26-Nov-20 5:17am
View
Deleted
I remember that I have tested this solution among others, but I will test is now to be sure.
csrss
25-Nov-20 6:26am
View
Yeah, if I update to ef core 5, a lot of queries stop working or are a lot slower, so this is why I stick to 3.1. This is strange, I have very similar thing like you do, then I do something like this:
db.Customers.Select(c => new
{
c.Name,
Currency = c.Currency ?? c.Firm.Currency,
}).Select(x => new { a = x.Currency.SomeListProperty.Where(...)})
And everything crashes. Everything is initialised with huge .Include().IncludeThen() etc
csrss
25-Nov-20 6:04am
View
My setup is this: .NET 5.0, ef core 3.1.
csrss
25-Nov-20 5:34am
View
First one does not work. Second one, cannot be done, because I need to run a query on selected property. So, my scenario is this: if client has a policy - take, if not - take company policy and then run a query for all rules contained within policy object, so this is .Where(...) on a result, returned by ternary operator and then there are next steps, and all this should be executed within one request to database, and all is Linq to sql. Client side execution is forbidden.
csrss
24-Nov-20 11:54am
View
Yeah, I understand. Thanks anyway. The more I am trying to do with this linq to sql - it is just crap and nothing else. Cannot translate the simplest queries. It can just perform Where() couple of times, some select and that's it. Nothing beyond.
csrss
24-Nov-20 11:49am
View
Yes, tried to do it that way, same result.
csrss
24-Nov-20 11:27am
View
Yes, I understand it cannot be translated, and that it runs on server, but there should be some way to do it like this?
csrss
17-Nov-20 10:20am
View
All objects are valid, non of them are nulls. But it seems to me that this line to sql is just dumb. Because even simple SelectMany fails, but there are no nulls.
csrss
17-Nov-20 4:10am
View
Thanks
csrss
14-Nov-20 12:14pm
View
I actually made it work
csrss
22-Oct-20 6:50am
View
I need expressions, because I am fetching 100% dynamic data.
csrss
29-Sep-20 5:20am
View
Yes, but I know about finding most common numbers in int array. The question is about algorithm to cluster data probably. I just wanted to know, if there are any applicable.
csrss
29-Sep-20 4:53am
View
Yes, the nearness should be calculated based on numbers in array. So we can see, that 10 is near 9 and near 11, but not near 100, or 1. From what I know, there are some clustering algorithms out there, but not sure if they will fit here?
Language is C#
csrss
22-Sep-20 4:31am
View
Yeah, probably hard to explain over the net. There is your regex:
^(?P<text>\w.*)(?P<num1>[\d]{2,},[\d]{2}|)\s(?P<fromdate>\d{1,}\s\w{3})\s-\s(?P<todate>\d{1,}\s\w{3})\s(?P<year>\d{4})\s(?P<num2>\d{2,},\d{2})$
And those are my 2 lines:
My super data plan 10gb mobile 99,00 1 jul - 31 jul 2020 99,00
My super data plan 10gb mobile 1 jul - 31 jul 2020 99,00
When I put everything in regex101 website, on the right side, I can see the matches. If I have those 2 lines, I will have 2 matches with the above regex, however <num1> will not be captured. If I remove 'or' from <num1> group, it will match first line and capture <num1> but will not match 2nd line. I am trying to match both lines, and capture <num1> in a first case, but omit it in 2nd case, so lets say I would have an empty group or no group - I have no idea how it works with regexes because I have little to no knowledge about regexes.
csrss
22-Sep-20 4:11am
View
Thanks, is it possible to capture <num1> in first case, while matching both lines?
csrss
22-Sep-20 3:54am
View
For now I am working in regex101 website, PCRE (PHP) is selected as Flavor
csrss
22-Sep-20 3:53am
View
Sorry, maybe I expressed myself in a wrong way. Lets say, there are 2 lines:
My super data plan 10gb mobile 99,00 1 jul - 31 jul 2020 99,00
My super data plan 10gb mobile 1 jul - 31 jul 2020 99,00
I am trying to understand how to match both of them
csrss
22-Sep-20 3:45am
View
And if you make it like this:
^(?P<text>\w.*)(?:[\d]{2,},[\d]{2}\s+)?(?P<fromdate>\d{1,}\s\w{3})\s-\s(?P<todate>\d{1,}\s\w{3})\s(?P<year>\d{4})\s(?P<num2>\d{2,},\d{2})$
Then 99,00 will be part of <text>
csrss
22-Sep-20 3:44am
View
Nope, doesn't work. If you use this regex and remove first 99,00 - nothing will be matched.
csrss
22-Sep-20 3:22am
View
Yes, but in this case, you have removed <num1> from regex
csrss
22-Sep-20 3:15am
View
Hmmm, I have modified your regex this way:
^(?P<text>\w.*)\s+(?:(?P<num1>[\d]{2,},[\d]{2}))?\s(?P<fromdate>\d{1,}\s\w{3})\s-\s(?P<todate>\d{1,}\s\w{3})\s(?P<year>\d{4})\s(?P<num2>\d{2,},\d{2})$
Because I want to make a <num1> optional. But so far I have no luck in making it work, because if I remove <num1>, then a line is required 2 spaces. If I make one space optional - this is not working. Any idea, how can <num1> can be made optional?
csrss
22-Sep-20 2:47am
View
Yep, thanks. Still space is needed of course:
^(?P<text>\w.*)\s+(?P<num1>[\d]{2,},[\d]{2})\s(?P<fromdate>\d{1,}\s\w{3})\s-\s(?P<todate>\d{1,}\s\w{3})\s(?P<year>\d{4})\s(?P<num2>\d{2,},\d{2})$
csrss
22-Sep-20 2:36am
View
First of, thank you. It works.
This is strange, I am testing regex on regex101 website, while this works when I open it on one computer I am now, does not when opened on another laptop - on which I was testing. Magic.
csrss
22-Sep-20 2:03am
View
I have updated my question
csrss
10-Mar-20 6:38am
View
I have add my sample data. I am trying to do recurrent grouping.
csrss
8-Mar-20 17:18pm
View
Maciej, I did the following way:
public static Dictionary<tkey1, dictionary<tkey2,="" tvalue="">> Pivot<tsource, tkey1,="" tkey2,="" tvalue="">(this IEnumerable<tsource> source, Func<tsource, tkey1=""> key1Selector, Func<tsource, tkey2=""> key2Selector, Func<ienumerable<tsource>, TValue> aggregate)
{
return source.GroupBy(key1Selector).Select(x => new
{
X = x.Key,
Y = x.GroupBy(key2Selector).Select(
z => new
{
Z = z.Key,
V = aggregate(z)
}).ToDictionary(e => e.Z, o => o.V)
}).ToDictionary(e => e.X, o => o.Y);
}
This one I took from the net. So after applying the above, next thing I did is:
.Pivot(x => x.Selector1, x => x.Selector2, (x) => x.ToList())
.Select(x =>
{
var obj = new ExpandoObject() as IDictionary<string, object="">;
obj.Add("Column1", x.Key); // mandatory known column
foreach (var val in x.Value)
{
// dynamic columns
obj.Add(val.Value.First().FieldName, val.Key);
}
return obj;
})
However, this is not sortable solution, because dynamic columns do not exist in same manner as known columns in dynamic object, so I just cannot sort with LINQ, of group, etcetera.
So I decided to stick with T-SQL and dynamic queries + stored procedure.
csrss
7-Mar-20 15:39pm
View
You see, I have already tried such solution as yours, but unfortunately it does not work.
csrss
7-Mar-20 15:30pm
View
There is no numeric data - all rows and columns consist of string values. No, I cannot do it like you say - pivoted table is applied to a bigger query so the result table is returned which has all possibilities of sorting and filtering data data.
csrss
15-May-19 19:53pm
View
Thanks but no. I mean, neuro evolution does not learn "on the fly" as it name may suggests. Evolutionary network evolve in a context of finite data. So, in fact, it acts in the very same way as, lets say, basic MLP. The only difference here is topology. So any combination with "regular" learning is pointless. Well, it seems that neural networks are limited to handle finite data. Thats it. NN is not much more then a regular algorithm.
csrss
30-Jan-19 14:22pm
View
Thanks for the bayesian keyword - I'll check it up. Still, if it cannot be trained "on the fly" - this is not a solution.
csrss
1-Mar-18 14:36pm
View
Richard, thank you a lot :)
I actually changed my design just a little bit by introducing additional non-generic interface and it solved the problem.
csrss
1-Mar-18 14:22pm
View
So it seems then I cannot use current design, because interface (ITest) uses T as in and out both. Thanks
csrss
23-Sep-17 7:35am
View
Here is formatted json:
[
[
"test",
{
"prop1": 1,
"prop2": "test",
"prop3": "test"
}
],
[
"test2",
{
"prop1": 2,
"prop2": "test2",
"prop3": "test2"
}
]
]
I still got no idea, what the object structure is.
Show More