Using standard MinGW (cc 4.9.3), I couldn’t compile C++11 test programs without lots of errors. The answer: use -std=gnu++11 rather than -std=c++11. Obvious, right?…
using namespace std;
shared_ptr<int> x(new int(42));
cout << (*x) << endl;
Error messages with “c++11”:
$ g++ --std=c++11 -o test test.cpp
In file included from c:\mingw\include\wchar.h:208:0,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\memory:72, from test.cpp:1:
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
and many, many more (444 lines total).
$ g++ --std=gnu++11 -o test test.cpp
Exercise for the reader: try TDM-GCC and tell me in the comments whether it works with c++11.
This morning I hit a test case in which, for the first time in over a year running the same Word VBA macro, a Range.Find.Execute Replace:=wdReplaceAll hung, then crashed Word 2013 (32-bit, running on Win8.1 x64). The Execute was running inside a custom Undo record, and was the first action taken inside that record.
Searching led me to this forum post by vbRichard suggesting that the empty Undo record was the problem. I edited my code to change the document after opening the record, before running Execute, and Execute now runs fine! Thanks to vbRichard, whomever you are🙂 . I also added code to clean up the change just before closing the Undo record.
Since my use case is English, I added a zero-width joiner (“ZWJ”, ChrW(&H200D)) before the text I was processing, then deleted it at the end. I could have used any character I was confident wouldn’t appear in the input, or wouldn’t affect the function’s main task. The result is below (licensed CC-BY 4.0).
' Top of module:
Private Const U_ZWJ = &H200D
' Inside a function:
Dim r as Range
' ... code here to set r ...
Dim undos As UndoRecord
Set undos = Application.UndoRecord
undos.StartCustomRecord "90125" ' or whatever record title you like
' now r includes the ZWJ.
r.MoveStart wdCharacter, 1 ' remove the ZWJ from r
' ... code here to process r ...
r.MoveStart wdCharacter, -1 ' re-select the ZWJ
If AscW(r.Characters.first) = U_ZWJ Then 'sanity check
r.MoveEnd wdCharacter, 1 ' select only the ZWJ
“Daybreak,” another forgotten prog gem, by Dutch band Mirror. Listen all the way to the end; the last five minutes are definitely worth it.
“Unsealed” by CarboHydroM. A massive orchestral/rock/instrumental reworking of the Zelda 3 soundtrack. I just listened to it twice in a row!
Turns out it can be done! This article from Slipstick Systems shows you how to enable the Query Builder in the Advanced Find dialog box.
I was trying to search for two partial words in the Subject of my emails in Outlook 2013. Turns out the “Search” box in the folder view only finds matches at the start of a word. The Advanced Search dialog box, Advanced pane, looked promising. However, when I added multiple criteria, I think it was ORing them rather than ANDing. Not sure, but I do know that I added two separate Subject terms and not all the results had both terms in their Subject fields.
With Query Builder, each search criterion I entered was automatically added to an AND group, and the search results were what I expected. Now if only you didn’t have to tweak the registry to enable this incredibly useful feature…
I do a lot of Visual Basic for Applications (VBA) development in Microsoft Office. Any program can get stuck in an infinite loop, and when my VBA programs have it has always meant data loss. The Internet to the rescue, as of not quite a month ago!
To break VBA code execution, at least in Office 2013, hit
Ctrl+Scroll Lock. Obvious, right?😉
Huge thanks to MSDN user povidla, who posted this solution in the MSDN forums. Povidla, if you’re reading this, please comment so I can thank you directly!
Just discovered this prog rock album from 1977 by a band called “Hands”. Never heard of the band before, but they’ve got a pretty nice sound!