namespace { foo = FooClass(); }
wtf does this accomplish?
namespace { foo = FooClass(); }
wtf does this accomplish?
I'd still love to see an example of using this where it makes sense.
I understand this idea that so many new things are championing of booleans having 3 or 4 values. It makes good sense to have deterministic handling of undefined or undeclared variables and to support some math oriented logic operations. BUT they really need to stop calling them booleans. C booleans win, 0 = false, every other bit pattern = true . You can't have undefined and 'gate not found' in a logic gate. All these new variables are nice for OO programming and plugging in java beans and .net whatever modules and webshit, but they are not booleans.
@ammoQ said:
In other languages, where this is possible, it's usefull because the inner function sees the variables of the outer function. For example, if it was possible in C, we could write something like this:
....
not an impressive example where this looks very desirable. In fact, in OO languages, it's rather useless and it's use would probably indicate the "functional decomposition" antipattern.
Ok I'm on the same page as you. I understand this concept. I've had to use lisp variants before. I just couldn't think of using it in c.
Do you care to explain any of this trampolining or a good use for defining a function in a function? I've used pointers to functions but I've always defined them in the normal fashion.
Thanks for clearing that up. However that brings up the question:
You can declare a function in the body of another function??
This won't compile and I don't know why. I'm sure it's some basic c++ thing that I should know but I'm stumped. Oh don't worry this isn't actual code. Just a test I typed up.
int globalvar;
class testme
{
public:
testme();
testme(int a);
void incr();
};
int main()
{
testme myClass();
//testme myClass(4); // using this constructor will make it compile
myClass.incr();
return 0;
}
testme::testme()
{
globalvar=0;
}
testme::testme(int a)
{
globalvar=0;
}
void testme::incr()
{
globalvar++;
}
What is my WTF? What is special about the default constructor?
any kind of serial or model number on the remote?
[quote user="overmyhead"]
$to = 'correctemail@correctdomain.com'
[/quote]
Maybe this isn't an edit and what the code actually had? instead of "$correctemail"...
[quote user="overmyhead"]
$message = 'Contact Form' . "\n\n";
$message = "Name: $name\n";
[/quote]
I don't really know PHP and I don't see the big wtf, but I think the "contact form \n\n" part of the message gets obliterated by the next line.
A couple of our field engineering guys were setting up a windows machine in our lab. All I managed to catch was:
IT guy 1: "Blue Screen of Death!"
IT guy 2: "Yup, that's a blue screen of death [some windows bashing]"
IT guy 1: "Kenel mode trap?!... Why would they put a trap in the kernel?"
[quote user="shadowman"]
I don't see the wtf... Sounds like they're making an analogy, as in:
The evolution in web development:
HTML -> JSP -> JavaServer Faces
is equivalent to this older evolution in programming:
Assembly -> Fortran -> Java
[/quote]
I concur
I think the easy dirty way if you're willing to enter a couple thresholds would be to find all the minima in the data below a threshold. Than for all the minima consolidate all minima within a certain time of eachoter (say .2 for the data you posted) to one minima.
Assuming you're trying to find the period of your pendulum I would suggest you use a discrete fourier transform. If you have access to a tool like matlab this will be easy to do. Squaring what you get back from a fast fourier transform gives you the power spectrum which will show you the frequency of your data as a giant spike. It's worth looking into.
Is your exercise to write a program that does this or are you just interested in the data? If you just need those data values can't you just look at the data and find the lowest points by inspection?
I would say the quickest way would be to use the distance formula.
So you have your color Y(r,g,b) and the color in the database D(r,g,b). To obtain your closeness value calculate the distance between them
Dist=sqrt( (Yr-Dr)^2 + (Yg-Dg)^2 + (Yb-Db)^2 )
You could store with each color in the database the color's distance from the origin (0,0,0) for a faster search of the database colors.
Thsi is no way an authoratative answer just an idea.