I seem to recall reading that the automated supply vehicles the Russians periodically send up to the ISS do routinely push it back up into a higher orbit, and I'll bet the cost of this is low enough that it'd be viable to keep doing this indefinitely, paid for by space tourists.
Except that it's not rusting nor are the few moving parts on it even a fraction of the cost of the whole the way they are on a car.
A better car analogy would be that you've got vintage Bugatti with almost zero mechanical wear on it that you've been restoring and pouring money into for the last decade or so. You just sourced a brand new engine for it at massive cost last year, paid millions to have brand new titanium transmission built for it (to Bugatti factory specs) the year before.
Your future plans include similar expenditures for the next five years, after which you plan to take a ceremonial shit on it and torch it.
How about selling it to the Russians for $1. Use the cash windfall to send a postcard to a random taxpayer saying "Sorry we fucked up".
The Russians kept Mir in orbit for ever, so I'm sure they can keep ISS up on a fraction of what NASA was pissing away on it, and can no doubt make a healthy profit keeping it full of space tourists. Maybe they can occasionally sell a spot to a NASA scientist if NASA can remember why they wanted to build it in the first place, and can figure anything useful to do up there.
For the consumer to be able to call 'p.sig.X', you'll have to give it the producer's class definition so it knows about 'sig'. Put your Consumer and Producer in separate files and see what kind of #includes you'll end up needing to make it work.
Yeah, to use QButton I'd have to #include qbutton.h in myWidget.cpp...
If you want to salvage anything out of this, I suggest you go read up on C# delegates, and then ponder if Qt's signal/slot mechanism would be needed if C++ had such a mechanism when Qt was designed (it still doesn't), then come back and reread this thread. Rename MemberCallBack as DelegateCallBack if it helps...
No, all Qt does is put a string lookup table inbetween producer and consumer. You could modify the example I gave to do the same if you want to (without modifying either Producer or Signal) just by creating an appropriate CallBack subclass, similiar to the method delegate one I demonstrated.
Making a connection in Qt takes the form: connect(producer, signal, consumer, slot), and it goes without saying that making a connection between two things is always going to require specifying what those two things are!
You apparently not only don't know templates, but you can't even read basic C++ code. The Producer class knows **zero** about what, if anything, is going to connect to it, or how they are going to do it. All it knows is that to emit a signal it calls Signal.emit(). The Signal class also knows **zero** about what and how anyone is going to connect to it - only that they will do so by providing a CallBack subclass that somehow does it. It has no way to know that we're going to pass a member delegate (as I demonstrated), or hook it into a lookup table at Qt does, or maybe send a TCP message across the world to a receiver object.
Too bad that as a beginner you arn't better aware of what you know and don't know. I've been programming professionally for almost 30 years. Being using C++ for the last 10 years. I do, unlike you, actually know this stuff.
that 'typename' keyword you use in your example is itself a "fairly recent" addition to the C++ Standard,
There are two totally unrelated usages of the "typename" keyword. In this usage it's 100% synonymous with "class". I just used it for clarity - I don't like calling things "class" unless they are classes.
In other words - just substitute the old "class" for "typename" and it will work the same.
Also, I don't believe your example really qualifies as "loosely coupled":
Huh? The connection is made entirely external to, without modifying and without the knowledge of producer or consumer! How could it possibly be any more loosely coupled? You obviously don't understand what the term means.
Well, given that UK law is based on common law, that rather goes without saying. It doesn't mean anything.
If you want to compare UK vs US regarding freedom of speech, the only meaningful question is what law is enforced, not whether it's based on a system of promises (which can be overridden when the government chooses) or not.
e.g. Say you're an extremist muslim cleric condoning the 9/11 attacks - will this get you arrested in the UK or US? I'd say that under Bush at least there's a fair chance you'd gave gotten a visit from the men in black, while in the UK more likely Tony Blair bringing you a cup of tea.
Comparing the "promises" of the UK vs US legal system, I'd much rather have the reality of haebus corpus in the UK vs the reality of potentially being held indefinitely in the US regardless of what the constitution "promises". Of course the UK has gone horribly soft on crime in recent years, which isn't a good thing either.
The point is that they are not constitutionally protected, hence states and local government not only can but do take away all sort of these things that people in the rest of the world regard as basic freedoms. The fact that it's local rather than federal government taking these freedoms away is no consolation. These are things that you really feel in your everyday life in the US if you've ever experienced anything different (I lived in the UK until age of 25).
OTOH from having lived the last 20+ years in the US, I've got to say that I've never felt for a second there was greater freedom of speech in the US, and in fact during Bush's second term and since I've felt the need to be watchful what I say online because I don't really feel we DO have freedom of speech in the US anymore. I also read militant Islamic clerics spouting anti-British hatred in the UK and wonder why on earth the UK has *so much* freedom of speech to allow it rather than just deport them!
As for the whole "proud to vote for a black man" thing... that IS racist. If you're more proud to vote for a particular candidate due to his race, you're a bigot, regardless of whether he's black, white, green, or purple.
Rubbish. You don't need to be color blind not to be racist.
I think the sentiment more expressed, or felt, than "proud to vote for a black man" was "proud that we (Americans) elected a black man", and you have to be totally ignorant of American history to see why people would not be proud of this and the progress it represents. The pride wasn't in electing a man because he's black (which would be racist), but in electing him despite it.
Well, this case was about two British guys running an anti-Jew hate site (including photos of dead Jews). There's nothing in the least bit idealistic or defensible about it other than the moronic "free speech! we must allow everything!" cry.
If a rogue US scientist got convicted of passing nuclear know-how to a terrorist group, what's the betting the./ mob will be howling at the idealistic outrage of it. He was an American! He had the right to say whatever he liked in that e-mail!
I've often joked that programming is a disease as much as a profession exactly because the logical thought patterns do tend to spill over into real-life where they are grossly inappropriate. A or B, free or not, may make sense in a program but shades of grey and intelligent discrimination tend to work better when dealing with humanity (you know, that carbon based stuff).
The US constitution was never meant to be a static document to be inviolate for all times.
If you ever visit Washington DC, then go to the Jefferson Memorial building on the tidal basin, and see what Jefferson himself had to say about it. To summarize, he basically says that he's not a fan of rapidly changing laws, but nonetheless it is necessary to change them and improve them as man advances so that as society becomes more civilized the law can also advance.
I very much doubt that Jefferson, or any other of the authors of the constitution, would deny that technology of the 21st century has changed the needs of the law. They didn't imagine a world where communications and free speech was not just about what one man said in the town square, or sent by horseback messenger to a correspondant, but could include mass-communication via the web and television, and could include subject matter so technologically powerful (e.g. nuclear secrets) that free speech would be trumped by other concerns.
Of course everyday law is about case law and precendent (in practice, as much in the US as much as in the UK), and the constitution is therefore not the directly applicable law of the land. The fine-grained decisions that the lower courts handle on a day-to-day basis are necessarily far more complex and contradictory than the few guiding principles of the 1st amendment, and even without the need for the law to change with society this is where the real need to interpret the law comes from.
FYI, regarding that last sentence, I'm a dual citizen who's been living in US for the last 20+ years.
The sad thing about most Americans is that their level of knowledge about other countries is so low that that they really believe they have more freedoms. You know in the UK you can actually walk down the road with your dog off the leash, take him into the pub if you want, then go home and burn some brush in your back yard. You can even go crazy and let off fireworks on Nov 5th, and buy some wine at the supermarket on a Sunday! Can you imagine?!!
Maybe as an American you should try exercising your "freedom of speech" in one of the myriad ways that also violates the law, before concluding that being American would make any difference. Extradition laws go both ways, so don't expect the Brits to save you either if you managed to jump bail after being convicted and left the US.
I can just see you in central square standing on a soapbox shouting out threats to the president, describing sex acts with children, and screaming racial insults at passers-by, then foaming at the mouth with outrage as the police lead you away. "Get your hands off me! I'm an American! I have freedom of speech!".
"Freedom of speech" in the US doesn't mean you can say whatever you want either. If you endanger other people by what you say (e.g. shout "fire" in a crowded theatre, incite others to murder, violence) there are consequences. If you slander someone there are consequences. If you lie under oath there are consequences.
Freedom of speech isn't a right that overrides all other laws, not should it be.
I'm amazed not only that this story was posted to/. but also that so many apparently have sympathy for these losers.
Fundamentally I agree - the Trolls needed to work with what was commonly available at the time Qt was designed.
However, you can do loosely coupled member callbacks in C++ without using anything too sophisticated. All you need is basic template support and member function pointers. The code below compiles and works with gcc 3.4.5 (i.e. a fairly old one).
#include <stdio.h>
// Define Signal class, emitting virtual CallBack class callbacks
template <typename Param> class Signal { private:
const CallBack<Param> *callBack;// Or a list of callbacks, if you want public:
Signal() : callBack(NULL) {}
void setCallBack(const CallBack<Param> &cb) {callBack = &cb;}
void emit(Param p) {(*callBack)(p);} };
// Now sublcass CallBack to allow use of class member functions
If you don't like the appearance of that setCallBack() call, you could always define a template function that would return this MemberCallBack constructor for you, and thereby let the compiler deducde the template parameter types for you.
Nowdays you could use the new C++ function objects (tr:func), which will be part of the C++00x standard.
I've seen the connect() declarations, but never really wanted to look at all the Q_OBJECT related macros. It works...
It is possible to use a 3rd party signal/slot libary, like Boost Signals, with Qt, but there's not much benefit in terms of prettyness since it still requires Q_SIGNAL/SLOT/EMIT preprocessor pseudo-keywords. I'm not sure what it'd take to ditch the entire Q_OBJECT meta-object approach... designer obviously needs some form of inspection and property support.
Still, given the enormous benefits, functionality and pleasure of use of Qt, this is really a minor gripe.
That does look ugly, but is it that just for making signal/slot connections, or do stringified method names get used elsewhere in Qyoto too?
I've got to say that, even as a Qt fan, moc and the signal/slot implementation in Qt don't feel so great in C++ either. I wish they'd deprecate it in favor of a pure C++ alternative (like Boost Signals, for example). Presumably there are better ways of implementing something similar in C# too.
Forking a process on unix-like systems if fairly lightweight but for Windows this will not scale well at all. Why not just have rendering worker threads? Have I missed something?
One of the main reason's threads are more lightweight than processes is because they share an address space (so it's cheaper to switch between threads - you don't need to reload page tables), but the downside of that is that one thread can corrupt another. Processes don't share memory hence they are better isolated from each other.
You should soon be able to use Qt for Symbian development.
Nokia own both Symbian and Qt, and the Qt labs blog is reporting Qt being ported to S60.
http://labs.trolltech.com/blogs/2009/06/29/port-of-qtwebkit-to-s60/
Note that Qt is an entire cross-platform library, not just for GUI - it includes stuff like threads, network comms, XML even WebKit!
I seem to recall reading that the automated supply vehicles the Russians periodically send up to the ISS do routinely push it back up into a higher orbit, and I'll bet the cost of this is low enough that it'd be viable to keep doing this indefinitely, paid for by space tourists.
Except that it's not rusting nor are the few moving parts on it even a fraction of the cost of the whole the way they are on a car.
A better car analogy would be that you've got vintage Bugatti with almost zero mechanical wear on it that you've been restoring and pouring money into for the last decade or so. You just sourced a brand new engine for it at massive cost last year, paid millions to have brand new titanium transmission built for it (to Bugatti factory specs) the year before.
Your future plans include similar expenditures for the next five years, after which you plan to take a ceremonial shit on it and torch it.
Makes sense, eh?
How about selling it to the Russians for $1. Use the cash windfall to send a postcard to a random taxpayer saying "Sorry we fucked up".
The Russians kept Mir in orbit for ever, so I'm sure they can keep ISS up on a fraction of what NASA was pissing away on it, and can no doubt make a healthy profit keeping it full of space tourists. Maybe they can occasionally sell a spot to a NASA scientist if NASA can remember why they wanted to build it in the first place, and can figure anything useful to do up there.
For the consumer to be able to call 'p.sig.X', you'll have to give it the producer's class definition so it knows about 'sig'. Put your Consumer and Producer in separate files and see what kind of #includes you'll end up needing to make it work.
Yeah, to use QButton I'd have to #include qbutton.h in myWidget.cpp ...
If you want to salvage anything out of this, I suggest you go read up on C# delegates, and then ponder if Qt's signal/slot mechanism would be needed if C++ had such a mechanism when Qt was designed (it still doesn't), then come back and reread this thread. Rename MemberCallBack as DelegateCallBack if it helps...
No, all Qt does is put a string lookup table inbetween producer and consumer. You could modify the example I gave to do the same if you want to (without modifying either Producer or Signal) just by creating an appropriate CallBack subclass, similiar to the method delegate one I demonstrated.
Making a connection in Qt takes the form: connect(producer, signal, consumer, slot), and it goes without saying that making a connection between two things is always going to require specifying what those two things are!
You apparently not only don't know templates, but you can't even read basic C++ code. The Producer class knows **zero** about what, if anything, is going to connect to it, or how they are going to do it. All it knows is that to emit a signal it calls Signal.emit(). The Signal class also knows **zero** about what and how anyone is going to connect to it - only that they will do so by providing a CallBack subclass that somehow does it. It has no way to know that we're going to pass a member delegate (as I demonstrated), or hook it into a lookup table at Qt does, or maybe send a TCP message across the world to a receiver object.
Too bad that as a beginner you arn't better aware of what you know and don't know. I've been programming professionally for almost 30 years. Being using C++ for the last 10 years. I do, unlike you, actually know this stuff.
that 'typename' keyword you use in your example is itself a "fairly recent" addition to the C++ Standard,
There are two totally unrelated usages of the "typename" keyword. In this usage it's 100% synonymous with "class". I just used it for clarity - I don't like calling things "class" unless they are classes.
In other words - just substitute the old "class" for "typename" and it will work the same.
Also, I don't believe your example really qualifies as "loosely coupled":
Huh? The connection is made entirely external to, without modifying and without the knowledge of producer or consumer! How could it possibly be any more loosely coupled? You obviously don't understand what the term means.
Well, given that UK law is based on common law, that rather goes without saying. It doesn't mean anything.
If you want to compare UK vs US regarding freedom of speech, the only meaningful question is what law is enforced, not whether it's based on a system of promises (which can be overridden when the government chooses) or not.
e.g. Say you're an extremist muslim cleric condoning the 9/11 attacks - will this get you arrested in the UK or US? I'd say that under Bush at least there's a fair chance you'd gave gotten a visit from the men in black, while in the UK more likely Tony Blair bringing you a cup of tea.
Comparing the "promises" of the UK vs US legal system, I'd much rather have the reality of haebus corpus in the UK vs the reality of potentially being held indefinitely in the US regardless of what the constitution "promises". Of course the UK has gone horribly soft on crime in recent years, which isn't a good thing either.
The point is that they are not constitutionally protected, hence states and local government not only can but do take away all sort of these things that people in the rest of the world regard as basic freedoms. The fact that it's local rather than federal government taking these freedoms away is no consolation. These are things that you really feel in your everyday life in the US if you've ever experienced anything different (I lived in the UK until age of 25).
OTOH from having lived the last 20+ years in the US, I've got to say that I've never felt for a second there was greater freedom of speech in the US, and in fact during Bush's second term and since I've felt the need to be watchful what I say online because I don't really feel we DO have freedom of speech in the US anymore. I also read militant Islamic clerics spouting anti-British hatred in the UK and wonder why on earth the UK has *so much* freedom of speech to allow it rather than just deport them!
As for the whole "proud to vote for a black man" thing ... that IS racist. If you're more proud to vote for a particular candidate due to his race, you're a bigot, regardless of whether he's black, white, green, or purple.
Rubbish. You don't need to be color blind not to be racist.
I think the sentiment more expressed, or felt, than "proud to vote for a black man" was "proud that we (Americans) elected a black man", and you have to be totally ignorant of American history to see why people would not be proud of this and the progress it represents. The pride wasn't in electing a man because he's black (which would be racist), but in electing him despite it.
Well, this case was about two British guys running an anti-Jew hate site (including photos of dead Jews). There's nothing in the least bit idealistic or defensible about it other than the moronic "free speech! we must allow everything!" cry.
If a rogue US scientist got convicted of passing nuclear know-how to a terrorist group, what's the betting the ./ mob will be howling at the idealistic outrage of it. He was an American! He had the right to say whatever he liked in that e-mail!
I've often joked that programming is a disease as much as a profession exactly because the logical thought patterns do tend to spill over into real-life where they are grossly inappropriate. A or B, free or not, may make sense in a program but shades of grey and intelligent discrimination tend to work better when dealing with humanity (you know, that carbon based stuff).
It's not that simple.
The US constitution was never meant to be a static document to be inviolate for all times.
If you ever visit Washington DC, then go to the Jefferson Memorial building on the tidal basin, and see what Jefferson himself had to say about it. To summarize, he basically says that he's not a fan of rapidly changing laws, but nonetheless it is necessary to change them and improve them as man advances so that as society becomes more civilized the law can also advance.
I very much doubt that Jefferson, or any other of the authors of the constitution, would deny that technology of the 21st century has changed the needs of the law. They didn't imagine a world where communications and free speech was not just about what one man said in the town square, or sent by horseback messenger to a correspondant, but could include mass-communication via the web and television, and could include subject matter so technologically powerful (e.g. nuclear secrets) that free speech would be trumped by other concerns.
Of course everyday law is about case law and precendent (in practice, as much in the US as much as in the UK), and the constitution is therefore not the directly applicable law of the land. The fine-grained decisions that the lower courts handle on a day-to-day basis are necessarily far more complex and contradictory than the few guiding principles of the 1st amendment, and even without the need for the law to change with society this is where the real need to interpret the law comes from.
FYI, regarding that last sentence, I'm a dual citizen who's been living in US for the last 20+ years.
The sad thing about most Americans is that their level of knowledge about other countries is so low that that they really believe they have more freedoms. You know in the UK you can actually walk down the road with your dog off the leash, take him into the pub if you want, then go home and burn some brush in your back yard. You can even go crazy and let off fireworks on Nov 5th, and buy some wine at the supermarket on a Sunday! Can you imagine?!!
"incitement"... Does that preclude the existence of free will?
It takes a bit more than that to prove it (the illusion of free will), but feel free to mention it in your paper.
Thanks for asking.
Dude, try to read a post before replying to it.
I didn't say "Freedom of speech isn't a right" - I said "Freedom of speech isn't a right that overrides all other laws".
It's kinda like the way you have the right to swing a baseball bat, but not into someone's face. Maybe you agree.
Maybe as an American you should try exercising your "freedom of speech" in one of the myriad ways that also violates the law, before concluding that being American would make any difference. Extradition laws go both ways, so don't expect the Brits to save you either if you managed to jump bail after being convicted and left the US.
I can just see you in central square standing on a soapbox shouting out threats to the president, describing sex acts with children, and screaming racial insults at passers-by, then foaming at the mouth with outrage as the police lead you away. "Get your hands off me! I'm an American! I have freedom of speech!".
"Freedom of speech" in the US doesn't mean you can say whatever you want either. If you endanger other people by what you say (e.g. shout "fire" in a crowded theatre, incite others to murder, violence) there are consequences. If you slander someone there are consequences. If you lie under oath there are consequences.
Freedom of speech isn't a right that overrides all other laws, not should it be.
I'm amazed not only that this story was posted to /. but also that so many apparently have sympathy for these losers.
Fundamentally I agree - the Trolls needed to work with what was commonly available at the time Qt was designed.
However, you can do loosely coupled member callbacks in C++ without using anything too sophisticated. All you need is basic template support and member function pointers. The code below compiles and works with gcc 3.4.5 (i.e. a fairly old one).
If you don't like the appearance of that setCallBack() call, you could always define a template function that would return this MemberCallBack constructor for you, and thereby let the compiler deducde the template parameter types for you.
Nowdays you could use the new C++ function objects (tr:func), which will be part of the C++00x standard.
I've seen the connect() declarations, but never really wanted to look at all the Q_OBJECT related macros. It works...
It is possible to use a 3rd party signal/slot libary, like Boost Signals, with Qt, but there's not much benefit in terms of prettyness since it still requires Q_SIGNAL/SLOT/EMIT preprocessor pseudo-keywords. I'm not sure what it'd take to ditch the entire Q_OBJECT meta-object approach... designer obviously needs some form of inspection and property support.
Still, given the enormous benefits, functionality and pleasure of use of Qt, this is really a minor gripe.
I guess you could call him an architect - that's Miguel de Icaza you just tried to insult.
That does look ugly, but is it that just for making signal/slot connections, or do stringified method names get used elsewhere in Qyoto too?
I've got to say that, even as a Qt fan, moc and the signal/slot implementation in Qt don't feel so great in C++ either. I wish they'd deprecate it in favor of a pure C++ alternative (like Boost Signals, for example). Presumably there are better ways of implementing something similar in C# too.
Think of network sockets, file access, threads, and a bunch of other things that quite frankly are annoying to do in C or C++.
Not if you use Qt which has all of those and more in addition to the GUI stuff.
Qt is a cross-platform library, not just a GUI library.
Qt-based apps run on Linux, Windows, Mac, Solaris, Symbian S60 ...
What are you using for the GUI in Mono? Windows Forms? You could have the full power of Qt via Qyoto...
Odd rant - totally unrelated to the point being made.
By common usage "Linux" refers to the whole thing, not the kernel, however much more correct that would be.
I'm not saying it's a good thing or a bad thing that Chrome's not Linux. It's just not - that's all!
That's interesting - I didn't realize that people were using it for it's own sake.
Forking a process on unix-like systems if fairly lightweight but for Windows this will not scale well at all. Why not just have rendering worker threads? Have I missed something?
One of the main reason's threads are more lightweight than processes is because they share an address space (so it's cheaper to switch between threads - you don't need to reload page tables), but the downside of that is that one thread can corrupt another. Processes don't share memory hence they are better isolated from each other.