|
Thanks!
Well the hardware's a tad more expensive, but, IMHO well worth it, so instead of linux, encourage everyone you know to consider OSX - at least they have a community that appreciates the full range of software, from free to commerical.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
I love it, use it as my day to day OS at home. Well I prefer freeBSD, but essentially everything applys, and I use both.
Everything is a file, and lamost always a file containing only charicters. This makes it simple. Once you can deal with files you can deal with anything. Oh once in a while you have to set some strange options (IP address means nothing on a file for instance).
The tools are powerful. Not easy to learn, but once you learn them easy to use and powerful. Tools like grep (searches for something in a file and can handle very complex searches) work because everything is a file of charicters.
Everything is logical and simple. Critical programs for a minimal system are in /bin, the rest of the system programs are in /usr/bin, and programs you install go in /usr/local/bin. 3 places to search and it is all there.
Remember, you cannot mistake easy to use with easy to learn. (Excpet when you are designing a kiosk where nobody uses it twice) Unix goes all the way: after a lot of training you can do some powerful things. Windows and the mac don't go nearly as far, and it makes powerful things hard to do.
vi deserves all the criticism it gets for being hard to learn and a pain to work with. I keep coming back to it though because it just works. Fast, and powerful.
|
|
|
|
|
/bin, /usr/bin, and /usr/local/bin, may be the layout on *your* system or distro, but it is by no means standard. There's /sbin, /usr/sbin, /usr/ucb (solaris looks for compilers there, beleive it or not), and I beleive other variations as well. The home directory, while frequently branched of off /home as a root, is not always done this way, for example solaris defaults to /export/home. Logical and simple would be to do what Apple does, or Win32 does - ONE directory (/Applications or /Program Files) for everything. The reason for having the multiple places to look was an easy hack solution to prevent people from running certain apps by just altering their $PATH. Of course if unix used real ACL's as a standard for file/process/etc permissions you wouldn't need any of that and you could just lock people down by group or user access, just like you can with Win32.
Remember, you cannot mistake easy to use with easy to learn.
This is just utter and complete bullshit, something all of us developers spout off about to justify writing sh*tty sloppy programs that are difficult to deal with. The fact of the matter is that Unix/Linux took dozens and dozens of sloppy, short sighted shortcuts in the way they implemented things, refusals to accept and enforce any sort of well thought out standards, and have stagnated as a result.
Note that I am not saying that Win32 or Mac are the end all be all of standards either. But, and it's an important but, they DO have a standard, and they do a pretty good job of enforcing it.
Windows and Macs, especially Macs, since they are BSD based under the hood now, and it's readily available, can be set up to do just as many difficult/powerful things as unix. And frequently where the "power" comes in is not from Unix per se, it's from the integrated high peformance hardware that it sits on.
What windows lacks is a really powerful native commandline line like unix that lets you easily script all sorts of crazy stuff. And it lacks some of the unix style comand line programs like sed and grep. However all of these have been ported over to windows and work just fine using cygwin, so it makes it a moot point to a certain degree.
If people *really* want to see fast, powerful, and well thought out, take a look at OpenVMS. It's been a complete eye-opener to see some of the stuff that it can do that unix, osx, and Win32 STILL don't do as well.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
I agree that unix is not the be all end all. I've never used VMS (or any mainframe OS), but I trust those who tell me there are advantages. However they are also able to see the disadvantages of those systems, one of which is losing some amount of power because not everything is a (normally text) file. Its a matter of trade offs. Unix ignored some things known about OS design when they designed it, but they also did a number of things right that windows ignored.
sbin is for system utilites that most users won't need, and often down have rights to call anyway. (If you need to be an admin to run some program why make is avaiable to the user?) I don't consider it fair to count that. And solaris does their own thing in most ways. There is a linux standards project that has standardised directory layouts, and most distributions follow it at least somewhat.
However all of this is just standard practice. I have a windows machine at work with a "c:\program files", and "d:\program files". I have seen linux distributions where all programs were in some form of /programs. With the standard unix layouts I can type "foo", and run a program that was just installed, while with windows I (or someone) has to adjust the path because programs are not installed in "program files" they are each installed in their own "program files\name" directory. Of course this has other advantages, so the only fair thing to say is it is different.
I still stand by the easy to use is not easy to learn comment. However you are not appling it as it was ment. Before you can decide where your program fits you need use cases to figure out who your users are. AT&T once made a complex hard to learn system because their operators were expected to use it for years, so saving a few tenths of a second here and there would not only making up the time to learn the system, but also save a lot of money. (this was back when AT&T was the monopoly) Most of us cannot go to that extreem because our users are not using only our app all day, but we do need to consider more than just learnability.
|
|
|
|
|
Hi,
This seems a newbie question. I wonder if we can set font for all Windows on screen with specify font? I tried to use Hook with message WM_PAINT and then do SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, TRUE).
However, some windows can change to new font, some cannot.
Please advise if there is any solution?
Thanks in advance
Khanh
|
|
|
|
|
Khanh Trinh wrote:
I wonder if we can set font for all Windows on screen...
Why would you want to do this? Unless an application needs a specific font, it should use the font that the user has established via control panel. Going against user settings is highly frowned upon. Further, no application should change the font used by another application.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
This is a special case, when the packaged software should use Windows default setting Fonts (include font and charset), however it does not. So in order to display correctly, I must do change font for that particular application.
Any idea in this case? I can change font for Buttons, Listbox, ComboBox, Textbox. But it seem the Editcontrol (Read-only), the Tab-label cannot be changed.
Thanks
|
|
|
|
|
Khanh Trinh wrote:
I can change font for Buttons, Listbox, ComboBox, Textbox. But it seem the Editcontrol
Strictly speaking, text box is a VB term, while VC++ uses the term edit control. Anyway, you've used both terms here, but apparently not interchangeably.
Khanh Trinh wrote:
But it seem the Editcontrol (Read-only), the Tab-label cannot be changed.
Are you talking about two different controls here? What is a "Tab-label?"
I'm not sure how you are changing the font of the other controls, but I use SetFont() when dealing with edit controls.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
you right about the terms. Actually, what I want is changing font of a combined application (another application) and I don't have that code. That's why I must set a Hook on WM_PAINT (not sure this message is correct or should capture another one), then do SendMessage with WM_SETFONT to set Font for that control.
Tab-label: I mean, the pages' caption of tab-control (sorry about incorrect terms)
So, with that I have dont, I can change font for most controls except somes indicated before.
|
|
|
|
|
I started an exe using createProcess and want to check on it:
while(1)
{
LPDWORD lpExitCode;
GetExitCodeProcess(ProcessInfo.hProcess, lpExitCode);
etc
}
I see in the debug that the hProcess isnt null (since my process started successfully). I was going to exit the process and see if I could detect it in my launching app. However, the code crashes at GetExitCodeProcess. I tried stepping into it, but it access violates immediately. What can I look into to see what is wrong?
As a workaround I am doing
while( ! (WaitForSingleObject(ProcessInfo.hProcess,1) == WAIT_OBJECT_0))
but I am curious as to why the first call crashes.
thanks,
sb
|
|
|
|
|
Should be:
DWORD dwExitCode;
GetExitCodeProcess(ProcessInfo.hProcess, &dwExitCode);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
ns wrote:
As a workaround I am doing
That's not a workaround... That's the way it should be done David's solution will fix the first call.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hello,
Does anybody know how to fix the error that I sometimes get with my application: the error is the nb 995 with the GetLasterror() function, and it says in the help:"when a I/0 operation is interrupted". My application is almost like a ping on a serial link of a PC to a special device: it writes a byte and then read the serial link to see if an answer is coming. It waits around 10 ms, and if nothing is arrived, it tries again. But sometimes, the fonction that reads the file that stores incoming data returns with this error 995. It can not happen a hundred times, but the one time it happens, it blocks everything(I mean my application cannot write/read on the serial link anymore), even if I exit from the application and come back it will happen again until I reboot my PC, and then everything is back to normal.
Please, HEEEELPPPPP!!!!
sojijolan
|
|
|
|
|
check out MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
Kuphryn
|
|
|
|
|
Please help me.
I whant set colot of line, in the CListCtrl, how can i do this?
But i dont whant use XListCtrl.
|
|
|
|
|
One way to accomplish this is to subclass the list control and handle WM_DRAWITEM . Set the text color of the hDC passed to the handler (as part of the DRAWITEMSTRUCT structure). For example:
void CMyListCtrl::DrawItem
(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
ASSERT (NULL != lpDrawItemStruct);
COLORREF rgbText = RGB (255, 0, 0);
VERIFY (CLR_INVALID != ::SetTextColor (lpDrawItemStruct->hDC, rgbText));
::DrawText (lpDrawItemStruct->hDC, ...);
} But a more flexible solution (imho) would be to use custom drawing. See this[^] article.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Can someone tell me why this code will not compile?
#include<vector>
class Pair{
public:
int a,b,count;
public:
Pair();
Pair(Pair& pP);
Pair(int pA,int pB,int pCt=1);
Pair& operator =(Pair& pP);
bool operator ==(Pair pP);
void operator ++(){++count;}
};
Pair::Pair(){a=b=count=0;}
Pair::Pair(Pair& pP){
a = pP.a;
b = pP.b;
count = pP.count;
}
Pair::Pair(int pA,int pB,int pCt){
a = pA;
b = pB;
count = pCt;
}
Pair& Pair::operator =(Pair& pP){
a=pP.a;b=pP.b;count=pP.count;return *this;
}
bool Pair::operator ==(Pair pP){
return (((a==pP.a)||(a==pP.b))&&(b==pP.a||b==pP.b));
}
template <class t="">
class VSet : public std::vector<t>{
public:
void add(T pT);
};
template <class t="">
void VSet<t>::add(T pT){
iterator i = begin();
while (i != end()){
if((*i)==pT){++(*i);return;}
++i;
}
push_back(pT);
}
void TestFunct(VSet<pair> *pV){
Pair P(1,2);
pV->add(P);
}
The line : push_back(pT)
seems to be the problem, if I comment it out it compiles fine.
I am using VCC 6.0
The 2 errors I get are :
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'const class Pair' (or there is no acceptable conversion)
and
error C2558: class 'Pair' : no copy constructor available
Any help would be greatly appreciated.
|
|
|
|
|
You need to define a copy constructor and overload the '=' operator, like it says. This is because implicit in your passing of arguments, a copy contructor is triggered. You can avoid this by passing arguments by reference - Add(T &pT) for example.
You should also be aware that if you are deriving a class from an STL container - it lacks virtual destructors, so you can never cast it back to the base class without problems.
|
|
|
|
|
Okay, but he did have a copy constructor and assignment operator in the pair class. Even though they were not const references, I've seen C++ books that did not use const references for those two types of functions. Was there a C++ standards change that requires const inputs to copy constructors and assignment operators? Or perhaps is the book incorrect?
The push_back always takes a copy and that was the original problem. The push_back, by definition will make a copy of the object and place the copy within the vector so you can not avoid that problem using a reference since push_back is already defined in the existing std::vector class. So the copy constructor is absolutely necessary for the pair class; no question.
|
|
|
|
|
digwizfox wrote:
I've seen C++ books that did not use const references for those two types of functions. Was there a C++ standards change that requires const inputs to copy constructors and assignment operators? Or perhaps is the book incorrect?
There is nothing in the standard, but assignment operators and copy constructors should not modify their parameters, so therefore they should be specified as const. Any parameter that is not modified should be const.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Something looks peculiar in your template class declaration. Vector is a template class. So you are specializing a template class. Shouldn't it be something like this?
template class <class t=""> VSet : public std::vector<class t="">
{
public:
void add(T pT);
};
That is how the examples that I have seen work. When you declar a template class, you have to put the generic type variable within <>. Also, the code that instantiates the vector (which I do not see in your example) will need to #include "pair.h" and instantiate the vector like below.
//Program needs to see the declaration of pair
#include "Pair.h"
#include "VSet.h"
//Instaniate the vector specialization
VSet<pair> p;
//Call the test function
TestFunc(&p);
Try something like that. If you have an STL book, search for some code examples using vectors so that you can see what I mean about declaring and instantiating a template class. I don't think your class declaration is correct.
I hope that will work for you but I haven't tested it. That information is basically right out of my C++ books. Obviously, the compiler doesn't know what a pair is so it can't know about the copy constructor and assignment operator. Also, you need the < class T > after the word template in your function definition as well. Try playing around with that and see if it works.
|
|
|
|
|
That's an HTML problem not a code problem - he cut and paste it without checking the "Do not treat <'s as HTML tags" below the textbox
-----------------------------
All truth passes through 3 stages.
First, it is ridiculed.
Second, it is violently opposed.
Third, it is accepted as being self-evident.
|
|
|
|
|
Oh now I see. Now that I read my own post, apparently the brackets are stripped out making the template parameters not show up. That is probably why the original post did not have them. Is that true beer belly?
So my post looked the same as yours because it did the same to me? So how do I get the " < text > " start and end brackets to show up in a post?
|
|
|
|
|
a) please post code in <pre> tags, and use the "Do not treat <'s as HTML tags" checkbox (or use < and > for < / > )
b) Assignment operator and copy constructor take an argument of type T const &
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
Sorry about that. This is what it should look like.
template <class T>
class VSet : public std::vector<T>{
public:
void add(T pT);
};
template <class T>
void VSet<T>::add(T pT){
iterator i = begin();
while (i != end()){
if((*i)==pT){++(*i);return;}
++i;
}
push_back(pT);
}
|
|
|
|
|