Brilliant stuff. Thanks Colin and thanks Microsoft!!! :eek: "From the top of the mountain, you cannot see the mountain."
Peter Godec
Posts
-
Finally -
Gruesome!It's a hoax. Not funny though :| .
-
Nish ShakesIt is SLOvenia and the chap you were having a discussion with yesterday was Tomaz (probably Tomaž - z with caron - you'll need some Central European encoding enabled to see it correctly). The capital is Ljubljana, (pronounced lyOO'blyänä). my-brain-is-available-but-don't-pick-too-hard-ly y'rs --pg :)
-
IMHO IMO...???The Canonical Abbreviation/Acronym List YAFIYGI. Don't go overboard though. YHBW-ly y'rs --pg :)
-
Question about CPoint objects...CDuddley wrote: to find the closest point If i understand correctly, you need to define a measure of distance between CPoints to do that. Most probably that would be euclidean distance , i.e. d = sqrt((x1 - x2)^2 + (y1 - y2)^2) So define a function that calculates the euclidean distance between two CPoints, maybe something like this:
#include <math.h> // or <cmath> and std:: if your compiler/library isn't broken
double distance(const CPoint& p1, const CPoint& p2)
{
return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y));
}a nicer variant (performance?) of this would be
double distance(const CPoint& p1, const CPoint& p2)
{
CSize diff = p1 - p2;
return sqrt(diff.x * diff.x + diff.y * diff.y);
}(of course, for your purpose, you don't need to calculate the sqrt, but now i'm blabbering) Now all you's gotta do is iterate over the array of CPoints, calculating the distance between your given test point and each point in the array and keeping track of the array index of the point that is the closest to the test point (now read this paragraph again). that-exercise-is-left-to-the-OP-ly y'rs --pg :)
-
What is it with American actors??Stan Shannon wrote: Isn't it amazing all the 'American's are like this' 'American's are like that' stuff you hear from people around the world? Yes, quite amazing. And the French are rude and smelly (or does that apply to all them European snobs), and the English have bad teeth (could someone explain that one to me), and the... it-works-both-ways-you-know-ly y'rs --pg :)
-
Pictures from the tripLOL, i didn't expect someone here at CP would have ever heard of Slovenia let alone wanted to visit it. I hope you'll enjoy your holiday. Unfortunately, August is probably not the best time for a visit, especially if you're planning to stay on the coast most of the time (it is crowded with tourists ;P). The main cities appear deserted since most of the locals are on vacation at that time too. The best month would be September i guess. Anyway, have fun. :)
-
Japanese developersCool! I've always assumed your name is of Spanish (Mexican) origin. I probably associated it with saguaro :). I would never thought of it being a Japanese name. My dictionary says it means something like "good fellow" or maybe even "mutual goodness", but i'm not good at this, so i could be way off. Call me weird, but i love japanese names, especially female ones:-O.
-
In the "Bad Product Names" category...Seems like the Japanese are the masters of weird product names. More funny product names and product descriptions for your viewing pleasure, courtesy of engrish.com all-your-base-are-belong-to-us-ly y'rs --pg :)
-
Is there any site that lets you download files via email?Hi Nish! Years ago i've used a piece of software that allowed me to do just what you're asking. I can't remember the name unfortunately, but it was probably just some kind of frontend to the services you'll find if you follow these links.
- Some general info: http://www.faqs.org/faqs/internet-services/access-via-email
- List of servers: http://www.expita.com/servers.html#www4mail
- Try these: http://www.kabissa.org/www4mail, http://www.bellanet.org/email.htm
Note that i don't use this stuff so i haven't clue whether it actually works or not. Fortunate-to-have-a-tad-faster-dialup-access-ly y'rs, --pg :)
-
help with algorithmWow. This problem is extremely non-trivial. Some time ago i've implemented line extraction using Hough transform (google it). Generalized HT can be used to detect any kind of parametric curve, although algorithm complexity grows exponentially with the number of parameters (e.g. two parameters for lines, three parameters for circles). HT is a simple algorithm once you grok it. The real difficulties are determining how to quantize the parameter space (accuracy vs. speed) and how to extract curve parameters from it. The one link i can give you: http://www.icaen.uiowa.edu/~dip/LECTURE/Segmentation2.html#hough
-
Variable Declaration & Initialization :: C++See C++ FAQ Lite. HTH, --peter
-
STL PollHave you read Scott Meyers 'Effective STL' yet ? I reckon it's the best book I bought this year. I've heard only good things about Meyers' Effective... books, but Stroustrup's bible and occasional visits to the comp.lang.c++ are sufficient for me right now (there are some really smart people on that newsgroup). While we're at it, another free source of great C++ info is the C++ Experts Forum on the CUJ website (quite advanced stuff though:omg: ). --peter
-
STL PollWaah, my first post to The Lounge and it's about programming :) . I thought I'd make myself useful first. Besides, I can't just look while you're putting down my favorite library. Anyway, it->second doesn't return anything. It can't because it is not a method/function, it's a member object of the class map<T1, T2>::value_type, that is, a member of pair<T1, T2>. So if you want a reference use it->second to initialize a reference of the corresponding type. No need for copies there. HTH.
-
Why doesn't CStatic keep the size of the icon when using SetIcon?Hi! Use the ::LoadImage API function instead of CWinApp::LoadIcon(). For example:
HINSTANCE hInst = AfxGetInstanceHandle();
hIcon = (HICON) ::LoadImage(hInst, MAKEINTRESOURCE(IDI_FOOBAR), IMAGE_ICON, 16, 16, 0);Hope this helps!
-
SocketsTry SocketMan. It is'a free and portable C++ library, so it pretty much fits your demands :) .
-
Need help quick on a couple of silly simple problemsYou need a handler for WM_SYSCOMMAND message. Maybe something like this:
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
CFrameWnd::OnSysCommand(nID, lParam);if (nID == SC\_MINIMIZE) { // Do your stuff here // like maybe call ShowWindow(SW\_HIDE) // or something? }
}
Don't forget to add ON_WM_SYSCOMMAND() to the message map:). HTH, peter