15,914,780 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 C++ questions
View Javascript questions
View Visual Basic questions
View Python 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 Doc Lobster (Top 29 by date)
Doc Lobster
18-Oct-16 14:49pm
View
Reason for my vote of 3 \n To Hell with scopes I say. Any real programmer will gladly remember the glorious days of goto. Needless to say, I would have a talk with anyone within my scope that would dare to use a goto. Once, not twice.
Doc Lobster
19-Nov-12 13:01pm
View
Yes, I'm aware of COleDispatchException*. It is derived from CException, so catching CException will do the job.
Doc Lobster
19-Nov-12 6:21am
View
Hi, thanks for your answer. LogString takes const CString& as parameter and the string is concatenated properly. Anyway, I found the solution, I'm calling Delete twice ...
Doc Lobster
3-Nov-12 5:37am
View
Hello Pete, thank you for your answer. I tried replacing the standard tab control with the one from the Cinch v2 demo, however the exception stays the same.
I also tried to reproduce the problem with a simple (no tab header and content templates) code-behind demo project, which didn't show the exception. The idea that the view is destroyed on a tab change sounded a bit strange to me, so I added two non-bound radioboxes in a tab of that demo project. Their values are kept after tab switching away an back.
As I already spent quite some time on this, I'm now ready to avoid this by switching to another UI design. :(
Doc Lobster
9-Feb-12 9:04am
View
Deleted
I see the point now. You want to do the comparison through the base class only (BaseClass::equals) which would bring you in a typical double dispatcher situation. However, thats not possible to implement since the child class is a template and you cant have virtual method templates. In that case I would do mostly the same as in your solution with the only difference of using typeid/type_info.
Doc Lobster
8-Feb-12 6:45am
View
Deleted
Maybe its a misunderstanding and we are not trying to do the same thing. Anyway, both my code samples do not need base classes: The first one just looks at the composed type (if the composed type is the same the template parameter must be identical, too), the second one deducts the template parameter type in the has_same_parameter_type function.
Doc Lobster
7-Feb-12 11:11am
View
Deleted
As the tip is currently written, the ChildClass<t>::equals method would be generating at least a warning because of incomplete code paths. Also the static_cast following the comparison is not used or leading anywhere.
I think code samples (even if it is only a tip) should be somewhat consistent.
Doc Lobster
7-Nov-11 4:00am
View
Deleted
Reason for my vote of 5
Yep, that solution efficiently gets rid of any special case handling as any number now is a special case.
Also this is extremely portable, e.g. to french (99 = quatre-vingt-dix-neuf)
Doc Lobster
4-Nov-11 2:50am
View
Deleted
ah, its a limitation on the WaitHandle. Have a look at
http://www.codeproject.com/KB/threads/smartthreadpool.aspx
it has its own waiting mechanism. Another solution may be to build your own thread-safe completion counter and waiting for that to reach 100.
I also found a good introduction to threading on http://www.albahari.com/threading/.
Doc Lobster
3-Nov-11 12:57pm
View
Deleted
I think thats strange. There's no limit named by MSDN for queuing items into the ThreadPool. Also please note that an item queued into the thread pool is not necessarily started instantly, but placed into the internal queue (therefore the name). The number of threads executed concurrently is much lower and is said to be depending on your system. So what you actually built is a queue on the queue - if this is necessary there should be an object-oriented and reusable way of doing it.
Doc Lobster
8-Oct-11 4:38am
View
Deleted
Thats right.
Doc Lobster
26-Sep-11 5:50am
View
Deleted
For the beginners - you should include _why_ try / catch is bad practice in this case.
Doc Lobster
24-Sep-11 6:14am
View
Deleted
Reason for my vote of 5
Yep, thats what I do too. Having the var makes it even easier.
Just because one knows how to write generics, extension methods and lambda expressions is not reason enough to use it everywhere.
Doc Lobster
23-Sep-11 4:21am
View
I suppose there is a certain degree of madness in most situations we have to cope with. Usual madness is okay by my standards, its something you can (or have to) hook off and get on with. It can be found anywhere, e.g. in a choleric co-worker. There is also unusual madness and sanity, I actually don't know which one of them is more threatening ;-)
Doc Lobster
21-Sep-11 4:12am
View
Deleted
My bad, I read the constructor execution path the wrong way around. Its a bit confusing to me that the simpler (shorter in means of arguments) constructors call the the ones being more complex.
Doc Lobster
21-Sep-11 3:18am
View
Deleted
I think there is a mistake in the refactored example. Originally every constructor would call DoStuff(), in the revised version only the constructor Something(string name, index) would do this.
Doc Lobster
5-Sep-11 3:28am
View
Deleted
Reason for my vote of 1
* malloc is C, not C++
* Bad usage of WideCharToMultiByte(...) - should be called twice, first time to evaluate output buffer size
* Assumes CString is wide-char
* std::string is usually host encoding (on windows some ansi cp), not UTF-8
* Missing exception handling may result in memory leaks
For such a common task as string conversion I expect a better solution
Doc Lobster
30-Jul-11 5:32am
View
Deleted
Reason for my vote of 1:
Sorry for being rude but this is an anti-tip if there is any:
double ConvertToDouble(CString strInput)
{
char * ch=new char[1000];
memset(ch,0,sizeof(ch));
return strtod(static_cast<cstringa>(strInput),&ch);
}
1) Allocating ch is not necessary
2) static_cast is unsafe and uncalled for in this context. Your app will break as soon as compiled for unicode. Thats even independant of the static_cast.
3) strtod is C, not C++. CString is MFC/ATL.
Doc Lobster
22-Jul-11 14:15pm
View
Deleted
Ah, I see. Its a C99 feature.
Doc Lobster
22-Jul-11 6:16am
View
Deleted
Why don't you just leave the optional macro parameter empty? RET_VAL_IF_NULL(p, ) does exactly what you want.
Doc Lobster
22-Jul-11 1:52am
View
Deleted
Unfortunatly not - I thought Substring(...) would cut the end of the string, not its start. See Daniels reply below
Doc Lobster
21-Jul-11 6:46am
View
Deleted
Hi Siavash, have you considered using a private enumeration and ToString() to get the property name strings?
Doc Lobster
21-Jul-11 6:44am
View
Deleted
Also you would have to use a magic number (4) so you still have the risk of setting the string range to an incorrect value (especially when using copy/paste). This isn't much better then the risk of a typo during entering the string.
Doc Lobster
19-Jul-11 7:31am
View
Huh, I can see that. Unfortunately sometimes IT departments mistake their customer (which is the rest of the company) for a disease to be contained. They also simply might be upset because they were not involved in the first place. Best way to deal with it is to take it easy ... probably ;)
Doc Lobster
14-Jul-11 16:08pm
View
Deleted
I like the metal umlaut in "önclick" ;-)
Doc Lobster
8-Jul-11 12:05pm
View
Have you experimented with xpath 2.0 functions? There are some allowing to convert item types, e.g. fn:string(0) or fn:number($rownr).
Doc Lobster
30-Jun-11 3:15am
View
Deleted
Hi Ataul, could you elaborate a bit on where you would use such a pattern and why it is better than passing the string pointer as normal parameter.
I also don't think CVHDDialogTmpl will work - its constructor initializes a member "str" which is not defined.
Doc Lobster
5-Jun-11 13:33pm
View
You can use the <pre> tag for C++ code highlighting if you add a lang attribute in the form <pre lang="C++"> ... </pre>.
Doc Lobster
25-May-11 0:03am
View
This won't do for 0-characters in the input string as they would be recognized as string terminator. It probably would help providing the input buffer length as second parameter to the CString contructor. BTW, help in the msdn is provided for the CStringT template, not for CString itself.
Show More