macros

Can record field updates in OCaml be generalized?

I'm a very novice OCaml programmer so please forgive me if this is a stupid/obvious question. There's a lot to absorb and I may have missed this in the documentation. I have a base of code that's starting to look like this: let update_x p x = add_delta p; p.x <- x; refresh p let update_y p y = add_delta p; p.y <- y; refre...

How can replace the string [Foo alloc]<cursor> with [[Foo alloc]<cursor>] in XCode?

Is there a key shortcut for this in XCode? Can I implement an Applescript for this and run it within XCode? ...

How can I create a context-menu macro in Outlook 2007 for links to open in my choice of browsers?

I want to have the context menu of links provide me an option to open in different browsers, rather than open in my default browser. For instance, Open in --> IE Firefox Opera Chrome Safari etc. ...

Creating a new pdf document using AcroEXch in VBScript

Hi I am looking to automate the conversion of an excel sheet into a pdf document (I do not want to manually print the report generated in excel as a pdf document every morning). For now, I would like to create a button in excel that will run the macro to automatically generate the pdf document, but this button will eventually not be us...

Word macro error messages

One of our clients has decided they need their document template macros changed and I am ~lucky~ enough to be given the job. The one thing I can't find out how to do is to customize error messages. For example an error message they get in a document is "Error! No table of figures entries found" I would like to change this to display so...

how to close the opened file?

hi all i opened a csv file and copy the contents. i activated an excel file and have the copied contents from csv file pasted into excel file. now,how do i close the csv file programmatically? ...

Learning the source code's filename at compile time

I'm using GCC; __FILE__ returns the current source file's entire path and name. Is there a way to get just the file's name and not its whole path too (at compile time)? Is it possible to do this in a portable way? Can template meta programming be applied to strings? I am using this in an error logging macro. I really do not want my sour...

Xcode Preprocessor Macros

In Xcode, I can edit my preprocessor macros in the project settings. I want to create a macro that refers to an environment variable. Basically, I want to be able to refer to $SRC_ROOT in my code. What I currently have in my macros is: SRC_ROOT=${SRC_ROOT} but it isn't working. ...

Profiling VBA code for microsoft word

I have some legacy code that uses VBA to parse a word document and build some XML output; Needless to say it runs like a dog but I was interested in profiling it to see where it's breaking down and maybe if there are some options to make it faster. I don't want to try anything until I can start measuring my results so profiling is a m...

What are some things that you've used Scheme macros for?

Many examples of macros seem to be about hiding lambdas, e.g. with-open-file in CL. I'm looking for some more exotic uses of macros, particularly in PLT Scheme. I'd like to get a feel for when to consider using a macro vs. using functions. ...

Visual Studio Macro - Code Gen Language

I am writing a macro for Visual studio that will generate some code. I would like for the macro to generate for both C# and VB, is there a way to determine what language is being used in the active (current) document? ...

Excel cannot enable references / missing functions

I have a working excel workbook that has VBA code and macros to help in data input. I use a calendar to capture dates and read data out of cells. The application works 100% on my machine (application developed in 2007 but saved as a .XLS – 97/2000 for compatibility in the office). When I give the file to other people, the calendar contro...

Insert Function Name during PreBuild

I wanted to write a Visual Studio Macro or something similar which can fetch function name and insert into preset location in the error report part. It's clearer if you look at the example Class SampleClass { public void FunctionA() { try { //Do some work here } catch (Exception ex) ...

Easiest way to call a Windows macro from Autohotkey (or VB)?

I have the following Macro I want to call from within an AutoHotkey script in order to set certain dates in my MonthCal object to be bold. http://msdn.microsoft.com/en-us/library/bb774722(VS.85).aspx How would I go about that? Note that it's possible the easiest way to do it is to write a simple VB script which uses the macro and cal...

C# version of __FUNCTION__ macro

Does anyone has a good solution for a C# version of the C++ __FUNCTION__ macro? The compiler does not seem to like it. ...

macro definition containing #include directive

Hi folks, Is there a way to define a macro that may contain #include directive in its body. If I just put the "#include", it gives error C2162: "expected macro formal parameter" since here I am not using # to concatenate strings. If I use "# include", then I receive the following two errors: error C2017: illegal escape sequence err...

How can I find out what a macro does without exposing myself to it?

I have been given two different Microsoft Word document that my virus scanner has warned me contains macros. These should be simple text files, and the person who sent them doesn't even know what a macro is; they may be a mistake on his part, but they might be signs of a malicious infection. My installation of OpenOffice.org is set not t...

How to write code just for debug mode in MFC vs2005

I want to define some member variable and some code just in Debug Mode, When change to Release mode, they will not appear. I know I can use #ifdef xxx to do this task. My question is : is there any handy macro provided by MFC to do this. ...

What makes lisp macros so special

Reading Paul Graham's essays on programming languages one would think that Lisp macros are the only way to go. As a busy developer working on other platforms I have not had the privledge of using lisp macros. As someone who wants to understand the buzz please explain what make's this feature so powerful. Please also relate this to somet...

GUI event recorder and playback

We are writing a relatively heavyweight C# GUI with some syncFusion(GUI framework) components. I would like to add client logging capability that QA could later use to playback client events in order to analyze bugs or other workflow the client used in production. Does such a ready made module for record and playback of all client keys...