Friday, September 11, 2015

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

"PRINCIPAL OF MURDERS&SLAUGHTERS SILVIO BERLUSCONI!" <odeshpaladesh@yahoo.com>: Sep 11 12:23PM -0700

CIVIL HERO & COMMODITIES, CURRENCIES, STOCKS GENIUS MICHELE NISTA MICHELENISTA@GMX.COM: HE GET IT RIGHT ON WORLDWIDE SECURITIES DE FACTO ALWAYS! BOUT 7320 PREDICTIONS SINCE AUGUST 1987 ( WHEN HE WAS +/- 20): 7320 SUCCESS! 100% SHOCKING WINNING SCORE!

GENIUS, KING MIDAS, CIVIL HERO MICHELE NISTA MICHELENISTA@GMX.COM! HE GET IT RIGHT ON WORLDWIDE STOCKS, CURRENCIES & COMMODITIES ALWAYS! ABOUT 7320 PREDICTIONS ON INTERNET SINCE 8.1987 (WHEN WAS MORE OR LESS 20 YEARS OLD): 7320 SUCCESS! 100% SHOCKING WINNING SCORE!!! GENIUS, KING MIDAS, CIVIL HERO MICHELE NISTA (MICHELENISTA@GMX.COM) ADVANCED IN EXTREMELY PERFECT WAY THE CONTINUOUS WALL STREET CRASH OF 1987 (.. AS SAID.. AT THAT TIME HE WAS, MORE OR LESS, JUST 20 YEARS OLD)! AS THE ONE OF 2007, 2008 AND BEGINNING OF 2009 WITH "JUST" 1 AND HALF YEAR OF INCREDIBLY WINNING FORETASTE! GENIUS, KING MIDAS, CIVIL HERO MICHELE NISTA MICHELENISTA@GMX.COM AVDANCED IN EXTREMELY PERFECT WAY, THEN, THE MORE OF DOUBLING OF WALL STREET, SINCE 3.2009! HE PROPHESIED ALL THIS ON INTERNET, AGAIN, WITH MONTHS AND MONTHS IN ADVANCE! ALL AT FANTASTIC LIGHT OF SUNSHINE!!! ALL PROVABLE AND VISIBLE STILL NOW!!! GENIUS, KING MIDAS, CIVIL HERO MICHELE NISTA (MICHELENISTA@GMX.COM) WAS "ONE OF THE NUMBER ONES" OF ITALIAN STOCK EXCHANGE, IN THE 90S, PRODUCING OVER 10 MILIONS OF EUROS OF COMMISSIONS OF THE 90S ( SO, 15 MILIONS OF NOW), FROM BELOW ZERO: WAS THE ABSOLUTE IDOL OF GOLDMAN SACHS, MERRILL LYNCH, AND NEARLY ANY "FOR GOOD" INVESTMENT BANK IN THE WORLD! THAT'S WHY EVERYONE WAS GIVING HIM AND STILL GIVE HIM THE NICK OF KING MIDAS! INGENIOUS HERO MICHELE NISTA HAS A GREAT HEART TOO, "NOT JUST" A SORT OF INVINCIBLE INTUITION! HE DEDICATES, SINCE HE WAS 17, ALL HIS GIFTS OF HEAVEN HE HAS TO POOREST PEOPLE IN THE WORLD, VOLUNTEERING AND NOT ONLY, FOR MANY ORGANIZATIONS SAVING OR IMPROVING SUFFERING LIVES IN LATIN AMERICA AND AFRICA. HE IS CERTAINLY A CIVIL INCORRUPTIBLE HERO TOO! IN THE LAST 21 YEARS, IN MILAN, WAS THE MOST TENACIOUS MAN HUNTING TO DESTROY THE ASSASSIN DICTATORSHIP OF MAFIOSO, MEGA MAFIA MONEY LAUNDERER, EXTREME NAZIFASCIST, LIAR, MEGA THIEF, CORRUPTING PIG, PRINCIPAL OF HUNDREDS OF MURDERS AND SLAUGHTERS, VERY ASCERTAINED PEDOPHILE SILVIO BERLUSCONI! FOR ALL THIS, THERE WERE FOUR ATTEMPTS OF KILLING HIM, ORDERED BY BASTARD SANGUINARY, AS WELL AS METASTASES OF THE ENTIRE WORLD: SILVIO BERLUSCONI!!! AND HIS FATHER LOST LIFE ON ORDER OF NAZIFASCIST AND COSA NOSTRA'S BRUTAL, VICIOUS, CRUEL, FEROCIOUS PRINCIPAL OF KILLING SILVIO BERLUSCONI (MAKING SHREWDLY TO PASS, VIA HIS PRIVATE OR PUBLIC NEW "OVRA, GESTAPO AND DINA" AL HIS ABSOLUTE REPELLENT HINDREDS OF HOMICIDES FOR FALSE ACCIDENTS, FALSE SUICIDES, FALSE ILLNESS, ALL THE TIMES)! AS A MATTER OF FACT, GENIUS, KING MIDAS, DEMOCRAT HERO MICHELE NISTA MICHELENISTA@GMX.COM "DECIDED TO EMIGRATE" TO LONDON, ON 2003, TO REMAIN ALIVE!! BUT GOD, IF HE'LL CONTINUE TO DESERVE SO, WILL MAKE HIM WIN!!! GROUP OF FRIENDS AND CLIENTS, EXTREMELY GRATEFUL TO THIS KING MIDAS, TO THIS INGENIOUS AND CIVIL HERO OF OUR TIMES: MICHELE NISTA (MICHELENISTA@GMX.COM)!!!
 

 
RUDI STUEZLI. SENIOR CONSULTANT GOLDMAN SACHS.
SG <s.gesemann@gmail.com>: Sep 11 02:41AM -0700

On Thursday, September 10, 2015 at 3:35:56 PM UTC+2, jacobnavia wrote:
> replaced with:
> int pbi = DiskBasedTree<T>::FindParentBranchIndex(parent_node, node);
 
> This "fixes" the problem.
 
You have yet to provide a short but *complete* example of one of your
problem cases. I'm guessing the context of this code fragment involves
templates and inheritance. If FindParentBranchIndex is supposed to be
a member function of a dependent parent class, you don't need to fully
qualify it by its class. It just takes a "this->":
 
int pbi = this->FindParentBranchIndex(parent_node, node);
 
This will make the compiler delay the name lookup until the 2nd phase
(instantiation). The reason why it's not possible to check this during
the 1st phase is because of a possible template specialization. Some
specialization of your base class template might not even have such a
member function.
 
I'm still recommending the book "C++ Templates: The Complete Guide".
 
Cheers!
sg
Anand Hariharan <mailto.anand.hariharan@gmail.com>: Sep 11 12:11PM -0700

On Thursday, August 27, 2015 at 5:04:56 PM UTC-5, jacobnavia wrote:
> > conform to the standard.
 
> Of course!
 
> How stupid from me. I just have to fix 344,356 lines of templated code...
 
Imagine a legacy C code base that was strewn with 'gets' and 'asctime'. Would you not give the same advice? (Agreed the effort required in your case would be significantly more.)
 
- Anand
Gerhard Wolf <leawolf@gmx.de>: Sep 11 10:39AM +0200

Hi,
 
with some changes (add classic to include and using statements)
i have managed to compile the:
 
http://boost-spirit.com/distrib/spirit_1_7_0/libs/spirit/example/application/sqlparser/spirit_sql.cpp
example.
 
its the first contact with spirit and it seems to be pretty complex.
The code seems to work as i understand it. But my first change request
would be to return more details of the failed parse, not only true or
false. A Position would be fine!
Any Tips?
"Öö Tiib" <ootiib@hot.ee>: Sep 11 05:29AM -0700

On Friday, 11 September 2015 11:40:00 UTC+3, Gerhard Wolf wrote:
> would be to return more details of the failed parse, not only true or
> false. A Position would be fine!
> Any Tips?
 
Basically you need to qualify some 'on_error<fail>' and some
expectation points ( by using > instead of >> ) and to get better
runtime errors you likely want to name the rules of yours like
'where_stmt.name("WHERE statement");'.
 
When you need examples then perhaps the example
http://www.boost.org/doc/libs/1_56_0/libs/spirit/doc/html/spirit/qi/tutorials/mini_xml___error_handling.html
is a good start.
 
By my impression:
* Spirit is lot nicer than to parse manually by iterating over character
buffers or by using regular expressions (but who does that anyway).
* Spirit is quite fast. It can parse integers faster than atoi
http://alexott.blogspot.com.ee/2010/01/boostspirit2-vs-atoi.html
* Spirit can seriously slow down compiling, better keep it away from
(commonly included) header files.
* Compiler error messages can be horrible with Spirit since it is using
C++ syntax as BNF. Parser generators provide far better diagnostics.
* Spirit has its limitations. About same as Flex/Bizon. One may need
ANTLR or Earley parser for complex grammar.
mark <mark@invalid.invalid>: Sep 11 03:38PM +0200

On 2015-09-11 10:39, Gerhard Wolf wrote:
> would be to return more details of the failed parse, not only true or
> false. A Position would be fine!
> Any Tips?
 
Yes, my tip is stay very far away from Spirit if you want to keep your
sanity. A recursive decent parser isn't really that much more code.
While the Spirit code may look simple at first glance, looks can be
very, very deceiving.
 
Once your parser gets a bit bigger, you will encounter completely
undecipherable error messages from deep within the bowels of insane
Boost template metaprogramming. A single error message can literally be
megabytes in size (IIRC, my record is 5MB). People have reported
inlining depths of several hundred levels deep. Good luck with trying to
debug your grammar, if your parser doesn't quite do what you expect.
 
IME, Spirit often produces poor code that's rather slow. E.g., my
straightforward JSON recursive decent parser is 50x faster than the 3
different Spirit JSON parsers I tried.
 
If you insist on using Spirit, make sure to compile your code with all
compilers you can get your hands on. You are almost guaranteed to hit
corner cases of the language.
mark <mark@invalid.invalid>: Sep 11 06:58PM +0200

On 2015-09-11 14:29, Öö Tiib wrote:
> * Spirit is quite fast. It can parse integers faster than atoi
> http://alexott.blogspot.com.ee/2010/01/boostspirit2-vs-atoi.html
 
You mean that buggy benchmark that only parses the int once?
 
---------------------------------------------------------
void test_spirit(int number_of_repeat) {
int val=0;
for(int i=0; i < number_of_repeat; i++) {
qi::parse(nstr,nstr+6,int_,val);
if (val != 123456)
std::cout << "Spirit Errror! val=" << val << std::endl;
}
}
---------------------------------------------------------
 
Note the missing error checking for the qi::parse result. In the first
iteration, nstr is advanced to the end of string and the rest of the
iterations parse an empty string.
 
Even then this benchmark is pointless since it only tests a hand-coded
int-parser that's part of Spirit and not an actual Spirit grammar:
 
boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
Jorgen Grahn <grahn+nntp@snipabacken.se>: Sep 11 11:03AM

On Thu, 2015-09-10, mark wrote:
> missing unless you have >= Win8).
 
> On 32-bit systems, contiguous address space is a limited resource and
> mmap isn't going to be simpler for large files.
 
Plus you cannot operate on streams which can't be mmap()ed. No
pipelines, no reading from stdin[0], no string streams for unit
testing ... I've considered using mmap() many times, but the drawbacks
have always put me off.
 
/Jorgen
 
[0] As a Unix guy, I really hate using software which cannot be
used in pipelines. It's a major usability problem.
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Jorgen Grahn <grahn+nntp@snipabacken.se>: Sep 11 02:05PM

On Thu, 2015-09-10, Christian Gollwitzer wrote:
>> converting activities, and I can't control the input formatting. 8<{{
 
> Understood. Still my advice would be to suck it into a database engine,
> like sqlite, and then execute queries instead of lengthy programs.
 
This is, I think, an area where there's a difference between "database
people" and "text file people". There's a lot of data processing you
can do very quickly and conveniently without SQL, even for large data
sets.
 
But yes, I acknowledge that someone can be very productive with
database queries. I haven't /met/ anyone like that, but that's
probably because they are rare in my immediate environment.
 
What's right for MikeCopeland, I cannot tell. I don't recall what
kinds of problems he's trying to solve, or if he has access to Unix
tools for text processing, and so on.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
mark <mark@invalid.invalid>: Sep 11 04:19PM +0200

On 2015-09-10 19:17, Christian Gollwitzer wrote:
> ultrafast loading/querying if you happen to work on the same data again.
> Many questions you asked in te past would be trivial to do from a
> relational database (joins, multiple index etc.)
 
If he can afford the performance hit from stuffing the data into a
database, his initial question was utterly pointless.
 
As long as the data fits into RAM, it's extremely easy to be several
times faster than a database engine like sqlite.
"Öö Tiib" <ootiib@hot.ee>: Sep 11 09:16AM -0700

On Friday, 11 September 2015 17:06:19 UTC+3, Jorgen Grahn wrote:
> people" and "text file people". There's a lot of data processing you
> can do very quickly and conveniently without SQL, even for large data
> sets.
 
Perl is typically the tool of text file people. One can win particular
query with C or C++. If the tendency of the complexity of queries that
we need to do seems to grow gradually then it is good time to filter
the data into some database with single sniff and suddenly the
flexibility what can be further done grows enormously.
 
 
> But yes, I acknowledge that someone can be very productive with
> database queries. I haven't /met/ anyone like that, but that's
> probably because they are rare in my immediate environment.
 
There are several orders of magnitude differences. I have seen
python script doing queries on described complexity SQL base in
0.05 seconds so there is appearance of real time processing on
web page serviced with that python script.
 
 
> What's right for MikeCopeland, I cannot tell. I don't recall what
> kinds of problems he's trying to solve, or if he has access to Unix
> tools for text processing, and so on.
 
Mike has always somehow managed to make his programs slow and resists
against using profiler. He uses Visual Studio on Windows.
See his "Building a Large Container"
http://www.thecodingforums.com/threads/building-a-large-container.966741/
ram@zedat.fu-berlin.de (Stefan Ram): Sep 10 11:38PM

>So I would prefer to return a virtual container that just supports input
>iteration and returns the requested results on the fly.
 
I wrote a custom iterator, but not a custom container.
 
#include <iostream>
#include <vector>
 
inline static int odd( int const i ){ return i % 2; }
 
struct even_iterator
{ ::std::vector< int >::const_iterator p;
::std::vector< int >::const_iterator e;
even_iterator
( ::std::vector< int >::const_iterator const begin,
::std::vector< int >::const_iterator const end ):
p{ begin },
e{ end }
{ normalize(); }
void normalize(){ while( p != e && odd( *p ))++p; }
void increment(){ if( p != e )++p; normalize(); }
friend bool operator ==
( const even_iterator & self, const even_iterator & other )
{ return self.p == other.p; }
friend bool operator !=
( const even_iterator & self, const even_iterator & other )
{ return !( self == other ); }
int const & operator*(){ return *p; }
even_iterator & operator++(){ p++; normalize(); return *this; }};
 
struct even_numbers
{ ::std::vector< int > const number;
::std::vector< int >::const_iterator const p;
::std::vector< int >::const_iterator const e;
even_numbers( ::std::vector< int > const & number ):
number{ number },
p{ ::std::cbegin( this->number ) },
e{ ::std::cend( this->number ) }{}
even_numbers( ::std::vector< int > && number ):
number{ ::std::move( number )},
p{ ::std::cbegin( this->number ) },
e{ ::std::cend( this->number ) }
{ ::std::cerr << "move constructor was called.\n"; }
even_iterator begin(){ return even_iterator( p, e ); }
even_iterator end() { return even_iterator( e, e ); }};
 
int main()
{ for
( int const num :
even_numbers( ::std::vector< int >({ 1,5,3,2,3,6,8 })))
printf( "%i\n", num ); }
 
. This prints
 
move constructor was called.
2
6
8
 
»even_numbers« is just a thin wrapper to return an iterator
of type »even_iterator« to the for loop, which skips all odd
numbers using the member function »normalize«.
 
The whole classes were written so that the code »for (int
num : even_numbers(vector<int>({ 1,5,3,2,3,6,8 })))« from
the OP not had to be changed.
 
Using templates, it should be possible to write it in a more
general way, so that not that much code has to reduplicated
to adapt it for other, similar uses. For example, to apply
another condition, only the »normalize« function needs to be
changed, which could come from a template argument class.
 
I never wrote an iterator or a move constructor before IIRC,
so it all might still be full of bugs! I appreciate any comments.
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: