- My C++ exercise for today - 5 Updates
- Compare boost::system::error_category - 2 Updates
- I am not interested in learning all C++ - 3 Updates
- My C++ exercise for today - 1 Update
- About programming and C++ ... - 1 Update
- More psychology about this C++ forum - 2 Updates
- About my C++ projects... - 1 Update
"Chris M. Thomasson" <invalid@invalid.invalid>: Mar 24 01:31PM -0700 On 3/24/2017 1:13 PM, Stefan Ram wrote: > Lambda My Ny Xi Omikron > Pi Rho Sigma Tau Ypsilon > Phi Chi Psi Omega [...] I guess just taking any given column; find the largest word in it, and use that length for the space of a differential from every "smaller" word in said column would allow for the + 1 space that should give the effect of your table spacing. So, lets say we take column 3 [0...3] We notice the largest number of characters are in the words Epsilon, Omikron and Ypsilon. We take that 7 as a max base. Well, we know that Kappa has less characters than 7, so we have a differential. Knowing the maxima of the word Epsilon, we know to add 2 spaces to Kappa in col 3, along with an extra space to provide the separation of 1 between the columns in the table. Assuming you wanted to add an extra column... Sorry if I missed something here Stefan! ;^o |
Ben Bacarisse <ben.usenet@bsb.me.uk>: Mar 24 09:58PM > Lambda My Ny Xi Omikron > Pi Rho Sigma Tau Ypsilon > Phi Chi Psi Omega Maybe: #include <sstream> #include <iomanip> #include <vector> #include <algorithm> std::string align_columns(const std::string &str) { std::vector<std::string::size_type> widths; std::istringstream is(str); std::string word; for (unsigned col = 0; is >> word; col = is.peek() == '\n' ? 0 : col+1) if (col >= widths.size()) widths.push_back(word.length()); else widths[col] = std::max(widths[col], word.length()); is.clear(); is.seekg(0); std::ostringstream os; os << std::left; for (unsigned col = 0; is >> word; col = is.peek() == '\n' ? 0 : col+1) os << std::setw(widths[col]) << word << (char)is.peek(); return os.str(); } #include <iostream> int main() { std::string source = R"( Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota Kappa Lambda My Ny Xi Omikron Pi Rho Sigma Tau Ypsilon Phi Chi Psi Omega )"; std::cout << align_columns(source); } <snip> > I also read a book recently about programming style. It > suggested to write small functions with readable names > and to prefer functions with no parameters. What extraordinary advice! What's the book? <snip> -- Ben. |
"Chris M. Thomasson" <invalid@invalid.invalid>: Mar 24 03:09PM -0700 On 3/24/2017 1:31 PM, Chris M. Thomasson wrote: > along with an extra space to provide the separation of 1 between the > columns in the table. Assuming you wanted to add an extra column... > Sorry if I missed something here Stefan! What about this logic wrt building a table on the fly: 24 words in your sample data columns = ceil(sqrt(24)) = 5 Fill in the table using the 24 [0...23] words with five columns. Table using integer indices for the words: _________________________ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 _________________________ index 4 would map to Epsilon index 9 would map to Kappa index 14 would map to Omikron index 19 would map to Ypsilon index 24 is "non-existent", except for a filler to make a 5x5 lattice. is this kosher for your exercise? |
"Chris M. Thomasson" <invalid@invalid.invalid>: Mar 24 03:15PM -0700 On 3/24/2017 1:31 PM, Chris M. Thomasson wrote: > word in said column would allow for the + 1 space that should give the > effect of your table spacing. > So, lets say we take column 3 [0...3] YIKES! That would be column 4 [0...4] with the words Epsilon, Kappa, Omikron and Ypsilon. Sorry for that non-sense. ;^o |
"Chris M. Thomasson" <invalid@invalid.invalid>: Mar 24 03:41PM -0700 On 3/24/2017 2:58 PM, Ben Bacarisse wrote: > )"; > std::cout << align_columns(source); > } Works like a charm. |
Christopher Pisz <christopherpisz@gmail.com>: Mar 24 01:53PM -0700 On Friday, March 24, 2017 at 11:46:11 AM UTC-5, Daniel wrote: > library, not the header files, so I would expect it to return a consistent > address. > Daniel I compared &(errorCode.category()) and &boost::asio::error::misc_category and they are indeed different even though errorCode.category().name() outputs "asio.misc", so I don't know wtf is going on. I also see that if (errorCode == make_error_code(boost::asio::error::connection_refused)) Evaluates to true when I dynamically link and false when I statically link. |
Daniel <danielaparker@gmail.com>: Mar 24 03:39PM -0700 On Friday, March 24, 2017 at 4:53:31 PM UTC-4, Christopher Pisz wrote: > I compared &(errorCode.category()) and &boost::asio::error::misc_category and they are indeed different even though errorCode.category().name() outputs "asio.misc", so I don't know wtf is going on. Did you try comparing errorCode.category() and boost::asio::error::get_misc_category() (using the function call) |
aminer68@gmail.com: Mar 24 03:05PM -0700 Hello, I am not interested in learning all C++, because i am not a programmer like you, and i am not a software engineer, i have gotten a Diploma of Microelectronics in 1988 and i have done embedded system programming, i am more like embedded system programming and real-time system programming, i don't need to learn all C++, because this is not my job, and i don't need to learn how to manage and program large projects, because this is not my job. This is why i am not seeking at discussing C++ with you on this forum. Thank you, Amine Moulay Ramdane. |
"Chris M. Thomasson" <invalid@invalid.invalid>: Mar 24 03:18PM -0700 > need to learn how to manage and program large projects, because this is not > my job. > This is why i am not seeking at discussing C++ with you on this forum. Why are you here? |
aminer68@gmail.com: Mar 24 03:38PM -0700 > Thank you, > Amine Moulay Ramdane. You were thinking that i am a programmer like you, but i am more like embedded systems programming and real-time system programming, my diploma is a diploma in Microelectronics and i have done embedded system programming when i have studied Microelectronics, so i am not here to learn C++ or to learn all C++, i have just invented my synchronization algorithms and i have programmed them into a C++ synchronization library , that i am announcing here from time to time, i am not seeking at learning C++ or discussing C++ here and i am not seeking at managing or programming large software projects, this is why i am explaining who i am. Thank you, Amine Moulay Ramdane. |
ram@zedat.fu-berlin.de (Stefan Ram): Mar 24 10:27PM >ram@zedat.fu-berlin.de (Stefan Ram) writes: >std::string align_columns(const std::string &str) That is very much more compact than my code. I will read through it carefully! >>suggested to write small functions with readable names >>and to prefer functions with no parameters. >What extraordinary advice! What's the book? Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. Until (at least) 2006 he was active in the newsgroup "comp.object", and I was given personal advice by him, e.g., (abbreviated below): |On 2006-06-28 01:16:09 -0500, ram@zedat.fu-berlin.de (Stefan Ram) said: ... |> So maybe the solution with getters is not that evil, after all? | |Getters and setters are not always evil, and too much dependency |inversion can lead to a mess. Engineering is always about tradeoffs. |-- |Robert C. Martin (Uncle Bob) In his book IIRC he makes the point that sometimes a plain data exchange object that just holds some public fields is the right thing and adding getter and setter access functions helps nobody in this case. He also explains the tradeoff between OOP and non-OOP more clearly that I ever read before: In OOP one can easily add new types, but it is hard to add new functions to a type hierarchy (every subtype must be changed to get the new function). In procedural programming it's easy to add new functions, but hard to add new types (many functions have type-switch-statements and all these statements need to be modified). |
aminer68@gmail.com: Mar 24 02:43PM -0700 Hello, About programming and C++ ... Jerry Stuckle is saying that i am stupid and he has dimished my projects.. I think that Jerry Stuckle is not understanding my way of doing, i am not interested in learning C++ meta-programming and how to manage large projects etc. because i am more leaning towards synchronization algorithms and real-time system and embedded system programming, this is why also i have invented many synchronization algorithms and this is why i have written my C++ MemPool for real-time systems, and i am also programming software tools in Object Pascal etc. so i am not a software engineer like you, i am more like embedded system programming and real-time system programming, it's what i have done when i have gotten my diploma in Microelectronics in 1988, so excuse me Sir , you are confusing the things, like Bonita is confusing the things, because i am not a software engineer, so i am not seeking at managing or programming large software projects, so when you understand me more, you will understand that your criticism towards me is not correct. Thank you, Amine Moulay Ramdane. |
aminer68@gmail.com: Mar 24 01:33PM -0700 > of those individuals on this forum, this is why i am explaining it to you. > Thank you, > Amine Moulay Ramdane. You are guided by Jesus Christ, the others are not, so becareful of your thoughts, because others are not guided by the love of Jesus Christ, and this is why i am more realistic than you. |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 24 02:06PM -0700 > so becareful of your thoughts, because others are not > guided by the love of Jesus Christ, and this is > why i am more realistic than you. From every frame of reference, the reasons I stated above are why people get frustrated with you, Amine. You are not a good participant in this forum (or in any forum I've seen you post in). You do not follow even liberal Usenet guidelines for posting. You are "your own man" doing "your own thing" for "your own purposes" and "the whole world be damned" in your eyes, for you will not alter the way you are, but you will instead accuse everyone else for the issues raised by your harmful presence, and the manner in which you post. You cannot see that you are the reason why people get upset, not some sidelong reason from other influences in people's lives. Those other influences may bring about a more or less hostile single response to your posting, but not the general sentiment you inspire in people over many months. You are your own worst enemy, Amine. And you make it worse when you lash out and insult people for their responses to you, even if they are hostile toward you. You should not be hostile back toward them. You should try to meet them where they are to the best of your ability, so that you can try to live at peace with them as much as it depends upon your side and input. Thank you, Rick C. Hodgin |
aminer68@gmail.com: Mar 24 02:01PM -0700 Hello, About my C++ projects... You have to set your perception right, Bonita and Stuckle are thinking that software programming is about large projects and managing large projects, and i think that this conception is not correct, because i have gotten a Diploma of technician in Microelectronics in 1988 and i have done embedded systems programming, and i know that embedded system programming is not programming and managing large projects, so this is why Bonita is not getting it right, because when i have invented synchronization algorithms and programming them, it is like doing embedded system programming, it is not managing and programming large projects, and when i have writtem my C++ MemPool for real-time systems, it's like doing embedded system programming, so you have to understand my way of doing, i have also written software many tools in Object Pascal, and programming software tools is not programming and managing large projects, i have also succeeded one year of pure mathematics at the university level of mathematics other than my Diploma in Microelectronics, and this has permitted me to write also my Scalable Parallel C++ Conjugate Gradient Linear System Solver Library, and this is not programming and managing large projects. So you have to be able to set your perception right by knowing the difference. Thank you, Amine Moulay Ramdane., |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment