The Weird and The Wonderful

The Weird and The Wonderful forum is a place to post Coding Horrors,
Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid
workarounds and developers just not quite getting it. And then somedays we come across - or write -
the truly sublime.

Post your Best, your worst, and your most interesting. But please - no
programming questions . This forum is purely for amusement and discussions on code snippets. All
actual programming questions will be removed.

Just in case the message gets removed from reddit again, I've decided to copy the text verbatim...

Hi fellows, I'm stuck I need to extract data, the code was send to me from the statistics department of Mexico I need to extract information from a webpage, it says is API information. I tried to copy and paste the code on Dev- C++ 4.9.9.2 and click on run but it says file not compiled, after that I save the file and still is the same. The information is about energy consumption. THANKS! <DATASET_BIINEGI xmlns="http://schemas.datacontract.org/2004/07/BIINEGI.Model" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Data> <GeneralNote/> <GeneralSource> Secretaría de Energía. Balance nacional de energía. </GeneralSource> <Serie> <Obs> <CurrentValue>9250.67</CurrentValue> <NotesPeriod i:nil="true"/> <SourcesPeriod i:nil="true"/> <TimePeriod>2010</TimePeriod> <ValueStatus/> </Obs> </Serie> </Data> <MetaData> <CreationDate>13/07/2015 10:23:56 a.m.</CreationDate> <Freq>Anual</Freq> <Indicator>13241</Indicator> <LastUpdate>2012/08/27</LastUpdate> <Name>Total</Name> <NoOfDecimals>3</NoOfDecimals> <Unit>Petajoules</Unit> <Region>Nacional</Region> </MetaData> </DATASET_BIINEGI>

I intentionally kept the delightful formatting of the original.

"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.

It could. You could, in addition, convert the CString to a std::sting, then copy everything to a char* which has previously been allocated with malloc, and allocate it in the loop, but don't use free. Before you do that translate everything to Klingon.

I have recently adopted a new laptop to the dismay of my desktop. The laptop comes equipped with a touchpad. I'm not one of those raised wrist typists, I always rest my wrists on the surface below the keyboard. More times than I can count I've wound up accidentally touching the touchpad moving the mouse pointer to parts unknown and destroying whatever it was I was typing.

I searched for a solution but didn't find anything that looked promising as a good solution so I gave up and contacted the laptop manufacturer's online help "chat". Had a solution in very short order: "fn" + "f9" to toggle on/off. I'm using W/8.1 and don't know if it is part of the standard OS functionality or an extension of some sort by ASUS. Regardless I wass pleased with the solution and thought I'd share.