> Flag-style enums use plural names while normal enums use singular names. As far as I'm concerned that's just another kind of Hungarian notation.
RenniePet
Posts
-
One-garian Notation -
One-garian NotationThat's true, but in many situations I prefer to define the enum in the class where it is to be used and made public. There is a longer discussion about this here: http://stackoverflow.com/questions/495051/c-naming-convention-for-enum-and-matching-property[^] If you look at that thread, the third-last post by someone named Hermann was the inspiration to my beginning heresy. :) C for constants and D for delegates came next, and my chances of redemption were gone. But I've resisted F for flag-style enumerators so far, although I'm not sure how much longer I can fight off the temptation. :(
-
One-garian NotationUh, yeah. Visual Studio 2010. It says:
Error 1 The type 'ConsoleApplication1.Program' already contains a definition for 'ProcessStatus'
on the line that attempts to define a property with the same name as the enumerator.
-
One-garian NotationHere: http://blogs.msdn.com/kcwalina/archive/2004/11/03/251722.aspx[^] But I should have said "generic types", not just types.
-
One-garian NotationOK, but my point is that you can't say this:
public enum ProcessStatus { ProcStopped, ProcStarting, // Has been started, but has not reported "up and running" ProcRunning, ProcStopping // Has been signaled to stop, but not stopped yet } public ProcessStatus ProcessStatus { get; set; }
That gives a compiler error.
-
One-garian NotationMaybe I'm not explaining myself very well ... Here are some examples:
const string CServiceName = "Merlinia Process Manager"; private delegate void DProcessProcessHasStopped(IntPtr processHandle); private DProcessProcessHasStopped \_processProcessHasStopped; private void InitializeCrossThreadInvocation() { \_processProcessHasStopped = ProcessProcessHasStopped; } private void CT\_ProcessProcessHasStopped(IntPtr processHandle) { base.InvokeDelegate(\_processProcessHasStopped, processHandle); }
This is part of a pattern in a class that supports cross-thread invocation of methods.
public enum EProcessStatus
{
ProcStopped,
ProcStarting, // Has been started, but has not reported "up and running"
ProcRunning,
ProcStopping // Has been signaled to stop, but not stopped yet
}public EProcessStatus ProcessStatus;
-
One-garian NotationWow, lots of comments! :) But I'd like to ask if anyone has any opinion regarding my suggesions, which I'm actually quite serious about, despite the humorous tone of my posting? - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. Justifications: - Previous standard for constants was THE_UPPERCASE_SCREAMING style, because constants are different. So I want to still emphasise that constants are different, and adding the C does that. - I often have a delegate declaration that is for a specific method, so it makes sense to use the name of the method with the D added to the front. - The use of enumerators often involves declaring a usage of the enumerator that naturally would have the same name as the enumerator itself, which isn't allowed. So by saying the enumerator name starts with E then the usage can have the same name without the E. Just like with INames for interfaces and TNames for types, these three things are sufficiently different from run-of-the-mill items that I like the idea of giving them special names.
-
One-garian NotationBeware all those who read the following, they are the irreverent ramblings of a heretic ... Religious beliefs are so tricky. For the true believer no alternatives can be possible. Their minds are closed. I was once a devout believer of Hungarian notation. Charles Simonyi was my guiding light. My strings were all szDecorated, and I was at peace with the world. But, as with all religions, there were those who would not accept the one true way. Hedonistic forces held sway at Microsoft, and .Net naming conventions repudiated Hungarian notation! I was thrown into confusion, and my world disintegrated around me! Had I been led astray? Were my beliefs really so faulty? All those years, for nothing? And then I noticed something incredibly suspect about the preachings of the anti-Hungarian notationalists. Despite their adamant claim that Hungarian notation was evil, they in reality espoused a corrupted form of Hungarian notation themselves! Yes, it is true, the anti-Hungarian notationalists are inconsistent! They call for the abolition of Hungarian notation, while preaching the following doctrine: - The names of interfaces must start with the letter I. - The names of types must start with the letter T. Why was this? How could they ask me to give up one faith for a new one that contradicted itself? And then one day my turmoil was resolved! In a moment of revelation the great nerd in the sky spoke to me: "Do not follow the preaching of others! Create your own religion, be true to yourself, and say to hell with the forces of conformity. It will be a rocky road, and you will be held in contempt, but you will discover an inner peace that not even Hungarian notation gave you." I call my new religion "one-garian notation". It can be considered to be a further development (or corruption, if you will) of the .Net naming conventions, where not just the names of interfaces and types have specific one-character prefixes, but the following as well: - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. That's it. One-garian notation (named because it is based on one-character prefixes) is the same as .Net naming conventions, plus the use of three additional one-character rules, for a total of
-
Googlish (satire)In the aftermath of World War III, the few survivors tried to piece together what had gone so horribly wrong, as all memory of civilization rapidly receded in the daily fight for survival. The time line was roughly as follows: 2014: Google did a major revamping of Google Translate, the language tools that performed translations of human languages. Google Translate supported at that time 51 languages, which implied a total of 2550 language-to-language combinations in order to provide all possible translations, for example between Ukrainian and Catalan. Instead of having to implement and maintain all these many combinations, Google created a new artificial language, Googlish, with a simple grammar and a completely unambiguous vocabulary. Now all translations were done in two steps, first from language A to Googlish, and then from Googlish to language B. The result was not only a huge reduction in the number of language combinations needed to be supported (from 2550 to 51) but increased quality of the translations. 2019: The number of languages supported by Google Translate had increased to 103, covering every human language spoken by 5 million people or more, or about 95% of the world's population's native languages. Most web sites and chat forums had become multilingual, in that everyone could view the site in their own language and contribute in their own language, thanks to Googlish. But the more exciting news was that the language processing techniques used by Google Translate had been applied to speech recognition. Google was now providing an online service that transcribed spoken words as written text, and with greater accuracy than previous methods. 2021: In a rather obvious further development of its technologies, Google Translate was now, with the help of Googlish, transcribing words spoken in one language into written text in any other language. The number of supported human languages was now up to 152, covering approx. 98% of the native languages of the peoples of the world. 2024: In another rather obvious development, Google Translate was able to read aloud text in any of the 174 supported languages. So now one person could say something in one language, and Google would recognize the speech, internally translate it into Googlish, then translate it to the second language and read it aloud to another person. 2027: Google Translate software was being licensed by most manufacturers of mobile telephones. Language skills were no longer a barrier to communications - just about any two peo
-
Computer-Enhanced Idiocy (satire)I'm very pleased to have been chosen as one of the few individuals to receive a pre-release copy of the keynote lecture that Lady Cecelia Montgovern-Baggley, Professor of Applied Cognition at the University of Slumberside, will be holding at the upcoming First Annual International Symposium on Computer-Enhanced Idiocy. Here, in full, is Lady Montgovern-Baggley's speech: Ladies and gentlemen, thank you very much for inviting me to give this keynote address at this ground-breaking symposium on the new field of research known as computer-enhanced idiocy. It is a great honor, an honor I, of course, share with my colleagues at the University of Slumberside who worked tirelessly with me in our investigations into this exciting new field of how human behavior is influenced by modern computer technology. First of all, a few words on nomenclature. As some of you may know, I am actually opposed to the use of the word "idiocy" with respect to the field of cognitive studies that we are engaged in, preferring to call it "alternative intelligence". However, I was out-voted at the last steering committee meeting, and I do, of course, respect that decision. Incidentally, I'd like to take this opportunity to apologize for my outburst at that meeting, when I claimed that the chairman was displaying superlative alternative intelligence. But now, to the subject at hand: The exciting new field of research into computer-enhanced idiocy. There has been much discussion and a certain amount of research into the related question of computer-enhanced intelligence. Most scientists are in agreement that computers have indeed increased our species' level of aptitude. We have all human knowledge gathered together in Wikipedia, we have instant access to news from around the world, we can search for information and we can communicate with each other in ways that only a few years ago would have been incomprehensible. So there is little doubt that computer-enhanced intelligence is here, and that we as a species are the better off for it. Unfortunately, what those who work with computer-enhanced intelligence often forget is that intelligence is not a dominant trait in the human species. We humans exhibit many other traits that outweigh intelligence, including idiocy. Our research at the University of Slumberside seems to indicate that humans, in general, tend to display approximately twice as much idiocy as intelligence, although there is a very great deal of individual variation. This news that human idiocy outweighs human intellig
-
Screen (or window) selection via head movementMy problem is not lack of mouse speed. My problem is lack of brain speed, or something. I typically have Visual Studio fullscreen on one screen, and Notepad++ fullscreen on the other screen, with documentation for the program I'm writing. I'm looking at one screen and thinking, and I'm looking at the other screen and thinking, and back and think and forth and think. I no longer am aware of which of the two windows is the active one. I just somehow assume that the one I'm looking at should be the active one. So when I decide to type something into the program I'm looking at I just start typing, and it irritates the hell out of me when I then discover that my keystrokes are going to the "wrong" window. Rennie
-
Screen (or window) selection via head movementThank you. I'll look into it.
-
Screen (or window) selection via head movementI have two screens, and I have some kind of intuitive feeling that when I look at one screen the window there (typically full-screened) should become the active window, and when I look at the other screen the window there should become the active window. So when I spin the scroll wheel on the mouse or start typing, I shouldn't end up feeling silly because the screen I'm not looking at is responding. I did a search and found a thread from 1 1/2 years ago on approx. the same subject: http://www.codeproject.com/Lounge.aspx?msg=2560207#xx2560207xx[^] The consensus back then was not very positive. But there was a link (now broken) in the second-last message about some game-related device that might have been useable. Anyway, does anyone know about something that can do this? Using a webcam and some software, or even using something I have to wear on my head? Thanks, Rennie
-
Microsoft Shuts Down the Internet (satire)As the world descended into chaos, Bill Gates (chairman for Microsoft's board of directors), Steve Ballmer (Microsoft's CEO) and Stephen Elop (president of Microsoft's business division) huddled together at Microsoft headquarters. "Did we really do this?" asked Steve Ballmer. "They're all saying it was our fault." "It wasn't intentional, I never saw it coming," said Stephen Elop, with a hangdog expression on his face. "OK, great, that makes me feel much better!" remarked Steve Ballmer. "But what the heck happened?" What followed was a long and fairly technical briefing, which Steve Ballmer occasionally found difficult to follow. The gist of the story was this: - To increase user productivity, the Microsoft Office 2010 team of developers had added an artificial intelligence filter to Outlook, so incoming e-mails were analyzed, and those exhibiting zero or low useful content were not delivered to the in-box. - Preliminary versions of this filter had sent a "bounce message" back to the sender informing him/her that their e-mail had failed an intelligence test and would therefore not be delivered to the recipient. - Limited beta testing had shown that this bounce message had a tendency to insult and infuriate the sender of the e-mail in question. Several of the beta test group members found themselves faced with a spouse demanding divorce or death threats from former friends. - To reduce the psychological repercussions of filtering out the dumb e-mails, another artificial intelligence program had been added to Outlook that automatically composed and sent an innocuous reply, purportedly from the recipient. (See ELIZA[^] for an example of a program of this kind.) In 99% of the cases this was sufficient to satisfy the sender of the original e-mail, and the situation seemed to be under control again. - Microsoft Office 2010 was released to wide beta test. - A few beta test customers reported that their e-mail servers were exhibiting signs of heavy loading. However, this did not seem to be a very serious problem, and it only affected a fairly small number of the beta test customers. Bill Gates had personally made the decision that these reports were given low priority, with the expectation that they would be looked into later if the problem persisted. - Microsoft Office 2010 was launched worldwide with much fanfare. The innovative marketing efforts ([](</x-turndown)
-
Looking for a log file browser and annotation programThanks for the suggestion, but that's not exactly what I had in mind. I want something that is more purpose-designed for this sort of thing. Maybe I'll have to make one myself, based on one of the fairly powerful text editor components that you can get for .Net programming. Rennie
-
Looking for a log file browser and annotation programDoes anyone know of a program suitable for browsing diagnostic log files, the kind typically written using, for example, log4net. The kind of logging a programmer puts in a program with lots of log.Debug() calls to create a log file for later analysis. Log files for when the program does not work correctly and you (the programmer) have to try to find the bug by looking at the log file. Not live analysis, after-the fact problem-finding. What I envision is a program that can be used by the programmer to open the log file, and browse around in it, highlight and "bookmark" some lines that look interesting, mark other lines and hide them to reduce the clutter, maybe mark and highlight all lines that contain certain text. Make it easier to peruse the file and finally find the clues to the problem. Thanks, Rennie
-
How to post code in a messageThanks. As a side-effect, two blank lines get collapsed to zero blank lines. Is there any way to avoid that? (One blank line is maintained as one blank line.) Rennie Edit: Never mind, it's something else. It's completely empty lines that are being collapsed. A single blank character prevents it.
-
How to post code in a messageIs it possible to post code in a message without all of the leading blanks being ignored so everything is left-justified? Thanks. Rennie