Click here to Skip to main content
15,881,938 members

Articles by Philippe Mori (Tip/Tricks: 7)

Tip/Tricks: 7

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.83

Database Development
SQL Server
3 Jan 2012   Updated: 3 Jan 2012   Rating: 4.67/5    Votes: 3   Popularity: 2.23
Licence: CPOL    Views: 31,760     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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...
Programming Languages
C#
29 Jun 2011   Updated: 29 Jun 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 6,252     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
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: 37,713     Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
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,281     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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: 6,932     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
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,181     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
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,330     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
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: 13,660     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
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,170     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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.

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Software Developer (Senior)
Canada Canada
Programmer at Maid LABS from 2003 (www.maidlabs.com)

Programmer-Analyst at Viasat Geo Technoligies from 1995 to 2002 (www.viasat-geo.com).

I have studied at École Polytechnique de Montréal in computer engineering.