Thursday, April 2, 2015

Digest for comp.lang.c++@googlegroups.com - 10 updates in 5 topics

ram@zedat.fu-berlin.de (Stefan Ram): Apr 02 09:36PM

>write a C++ program to print number of zeros of a series of 10 numbers
>entered by the user.
 
#include <iostream>
#include <ostream>
#include <string>
#include <algorithm>
 
static inline unsigned long long zerocount()
{ ::std::string number; ::std::cin >> number;
// ::std::strtold( number ); // throw if not a numeral
return count( number.begin(), number.end(), '0' ); }
 
int main()
{ unsigned long long count = 0;
for( int i = 0; i != 10; ++i )count += zerocount();
::std::cout << count << '\n'; }
David Harmon <source@netcom.com>: Apr 02 11:53AM -0700

On Mon, 30 Mar 2015 08:56:55 -0700 (PDT) in comp.lang.c++, ???? ???
<md.rg8910@gmail.com> wrote,
>write a C++ program to print number of zeros of a series of 10 numbers
>entered by the user.
 
OK, I did it.
Christopher Pisz <nospam@notanaddress.com>: Apr 02 02:10PM -0500

On 4/2/2015 1:53 PM, David Harmon wrote:
>> write a C++ program to print number of zeros of a series of 10 numbers
>> entered by the user.
 
> OK, I did it.
 
Me too! Was fun stuff!
 
--
I have chosen to troll filter/ignore all subthreads containing the
words: "Rick C. Hodgins", "Flibble", and "Islam"
So, I won't be able to see or respond to any such messages
---
Melzzzzz <mel@zzzzz.com>: Apr 02 09:58PM +0200

On Thu, 02 Apr 2015 14:10:56 -0500
 
> Me too! Was fun stuff!
 
I didn't ;)
woodbrian77@gmail.com: Apr 01 09:50PM -0700

What do you think of this class?
 
class failure : public ::std::exception {
::std::string whatStr;
 
public:
explicit failure (char const* w) : whatStr(w) {}
explicit failure (::std::string w) : whatStr(::std::move(w)) {}
 
~failure () throw() {}
 
char const* what () const throw()
{ return whatStr.c_str(); }
 
failure& operator<< (char const* s)
{
whatStr.append(s);
return *this;
}
 
failure& operator<< (char* s)
{
whatStr.append(s);
return *this;
}
 
failure& operator<< (::std::string const& s)
{
whatStr.append(s);
return *this;
}
 
template <class T>
failure& operator<< (T val)
{
whatStr.append(::std::to_string(val));
return *this;
}
};
 
I'm thinking about changing it to something like this:
 
class failure : public ::std::string {
 
public:
explicit failure (char const* w) : std::string(w) {}
explicit failure (::std::string w) : std::string(::std::move(w)) {}
 
~failure () throw() {}
 
template <class T>
failure& operator<< (T val)
{
this->append(::std::to_string(val));
return *this;
}
};
 
Some preliminary tests show smaller executable sizes with
this second approach.
 
And there are *many* topics in this thread that I'd like
more thoughts on. Thanks in advance.
 
Brian
Ebenezer Enterprises - "The fear of the L-RD is the beginning
of wisdom, and knowledge of the Holy One is understanding."
Proverbs 9:10
 
http://webEbenezer.net
Daniel <danielaparker@gmail.com>: Apr 02 05:04AM -0700

> whatStr.append(s);
> return *this;
> }
 
I think it's a bad idea to mutate an exception instance once thrown, rather, create new exception instances that preserve the old information and augment with new. You may wish to keep a chain of original and augmented exceptions, but in any case the exception should be immutable.
 
Daniel
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 02 07:20PM +0100

> this second approach.
 
> And there are *many* topics in this thread that I'd like
> more thoughts on. Thanks in advance.
 
You should have rich exception types that relate to the actual
exceptional behaviour not a generic "failure" type which is little
better than throwing a std::string (and makes catching specific
exceptions harder).
 
/Flibble
boris.yablonsky@gmail.com: Apr 02 10:51AM -0700

I could just find 2 books on C++14 :
 
Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14 by Scott Meyers
 
and
 
C++14 FAQs by Chandra Shekhar Kumar
 
Is there any other book on C++14 I should be laying my hands on ?
pww19710430@gmail.com: Apr 01 06:43PM -0700

Title: The core of the core of the big data solutions -- Map
Author: pengwenwei
Email:
Language: c++
Platform: Windows, linux
Technology: Perfect hash algorithm
Level: Advanced
Description: Map algorithm with high performance
Section MFC c++ map stl
SubSection c++ algorithm
License: (GPLv3)
 
Download demo project - 1070 Kb
Download source - 1070 Kb
 
Introduction:
For the c++ program, map is used everywhere.And bottleneck of program performance is often the performance of map.Especially in the case of large data,and the business association closely and unable to realize the data distribution and parallel processing condition.So the performance of map becomes the key technology.
 
In the work experience with telecommunications industry and the information security industry, I was dealing with the big bottom data,especially the most complex information security industry data,all can't do without map.
 
For example, IP table, MAC table, telephone number list, domain name resolution table, ID number table query, the Trojan horse virus characteristic code of cloud killing etc..
 
The map of STL library using binary chop, its has the worst performance.Google Hash map has the optimal performance and memory at present, but it has repeated collision probability.Now the big data rarely use a collision probability map,especially relating to fees, can't be wrong.
 
Now I put my algorithms out here,there are three kinds of map,after the build is Hash map.We can test the comparison,my algorithm has the zero probability of collision,but its performance is also better than the hash algorithm, even its ordinary performance has no much difference with Google.
 
My algorithm is perfect hash algorithm,its key index and the principle of compression algorithm is out of the ordinary,the most important is a completely different structure,so the key index compression is fundamentally different.The most direct benefit for program is that for the original map need ten servers for solutions but now I only need one server.
Declare: the code can not be used for commercial purposes, if for commercial applications,you can contact me with QQ 75293192.
Download:
https://sourceforge.net/projects/pwwhashmap/files
 
Applications:
First,modern warfare can't be without the mass of information query, if the query of enemy target information slows down a second, it could lead to the delaying fighter, leading to failure of the entire war. Information retrieval is inseparable from the map, if military products use pwwhashMap instead of the traditional map,you must be the winner.
 
Scond,the performance of the router determines the surfing speed, just replace open source router code map for pwwHashMap, its speed can increase ten times.
There are many tables to query and set in the router DHCP ptotocol,such as IP,Mac ,and all these are completed by map.But until now,all map are using STL liabrary,its performance is very low,and using the Hash map has error probability,so it can only use multi router packet dispersion treatment.If using pwwHashMap, you can save at least ten sets of equipment.
 
Third,Hadoop is recognized as the big data solutions at present,and its most fundamental thing is super heavy use of the map,instead of SQL and table.Hadoop assumes the huge amounts of data so that the data is completely unable to move, people must carry on the data analysis in the local.But as long as the open source Hadoop code of the map changes into pwwHashMap, the performance will increase hundredfold without any problems.
 
 
Background to this article that may be useful such as an introduction to the basic ideas presented:
http://blog.csdn.net/chixinmuzi/article/details/1727195
jacobnavia <jacob@jacob.remcomp.fr>: Apr 02 04:56PM +0200

> First,modern warfare can't be without the mass of information query,
 
if the query of enemy target information slows down a second, it could
lead to the delaying fighter, leading to failure of the entire war.
 
Apes do warfare. They band into a group of males and attack and kill the
males of the neighboring group to get more territory and the females.
 
Soldiers continue this animal tradition. They are paid for killing
people, destroy the "enemy", do the "Jihad".
 
There is nothing more ANIMAL as the act of war. Even with perfect
hashtables you are just a SOLDIER, a KILLER, the enemy of mankind.
 
True, in these times of decadence, where the scientist, the artist, the
worker are despised, the soldier is the image of the ideal man.
 
But everything we have, everyting we use, was done by workers,
scientists, artists. The superior men.
 
Soldier are the essence of the inferior men: they know only to provoke
destruction. Hash tables or just a bloody sword. They didn't invent
anything, they didn't build anything, they left us just their horrible
deeds.
 
Those that live by the sword will die by the sword. Yes, you can do
anything with guns, except sit on them :-)
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: