SQL Server |
3 Jan 2012
Updated: 3 Jan 2012
Rating: 4.67/5
Votes: 3
Popularity: 2.23
Licence: CPOL
Views: 32,320
Bookmarked: 1
Downloaded: 0
In my opinion, Local to UTC time conversion should be done nearer to UI level. That is, you should pass UTC time to your query and the time should be converted later when it is displayed to the user.Doing the conversion in code will simplify SQL queries and thus probably improve overall...
|
C# |
29 Jun 2011
Updated: 29 Jun 2011
Rating: 5.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 6,473
Bookmarked: 0
Downloaded: 0
Instead of doing it yourself, a better way would be to use LINQ for that purpose. Here is an example for addition:int[] numbers = { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };int result = numbers.Aggregate((x, y) => x + y).ToString());and for multiplication:long[] numbers = { 4, 5, 6, 7,...
|
|
25 Jan 2011
Updated: 25 Jan 2011
Rating: 4.95/5
Votes: 12
Popularity: 5.16
Licence: CPOL
Views: 41,694
Bookmarked: 4
Downloaded: 0
Alternative 2 can be enhanced by returning a booleen value if we want to code something similar to the original example. A (early) return value of false would indicate a failure which could then be handle by checking the function result.if (!DoAllActions()){ ...
|
|
25 Jan 2011
Updated: 26 Jan 2011
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 6,551
Bookmarked: 2
Downloaded: 0
If the number of conditions is relatively small, the following code would made sense: bool bFailed = true; if (!condition1_fails) { if(!condition2_fails) { ... if(!conditionN_fails) { bFailed=false; ...
|
C++ |
14 May 2011
Updated: 14 May 2011
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 7,122
Bookmarked: 3
Downloaded: 0
inline std::wstring AsciiToUnicode(std::string text){ // Could do some DEBUG check here to ensure it is really ASCII. // Also, if in the future, it is found, it is not the case, // it would much easier to update code. // Same as jean Davy here... return...
|
|
2 Jul 2011
Updated: 3 Jul 2011
Rating: 4.20/5
Votes: 2
Popularity: 1.26
Licence: CPOL
Views: 5,332
Bookmarked: 0
Downloaded: 0
Since you must pass the string at each instanciation points, it is useless to make a template argument for it.templatestruct CVHDialogTmpl{ CVHDialogTmpl(const char *ptr_) : ptr(ptr_) { } INT_PTR DoModal() { return t.DoModal(ptr); } Ty t; ...
|
|
4 Jul 2011
Updated: 4 Jul 2011
Rating: 5.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 6,471
Bookmarked: 0
Downloaded: 0
Provided that the intent is to associate a string (const char *) with a particular dialog type, an implementation like this one could be used.templatestruct CVHDialogTmpl{ CVHDialogTmpl() { } INT_PTR DoModal() { return t.DoModal(ptr); } ...
|
|
28 Oct 2011
Updated: 28 Oct 2011
Rating: 5.00/5
Votes: 4
Popularity: 3.01
Licence: CPOL
Views: 14,060
Bookmarked: 0
Downloaded: 0
The original solution has many flaws. Arguments and return types are not what they should be in most cases (by value vs. by reference and also for the constness). No code reuse and also some operators are not doing what would be intuitive like the unary minus.Information here is much more...
|
SQL |
17 Jul 2011
Updated: 17 Jul 2011
Rating: 5.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 7,372
Bookmarked: 1
Downloaded: 0
LINQPad is an interesting tool to try queries.LINQPad[^]Perfect tool to try out some alternatives for complex queries. As we can see generated queries and elapsed time, it help a lot to help having fast queries for complex requests.
|