macros

vba: macro escapes for-loop !

sub main() '''some more code''' For j = InStr(1, stext, " ") To Len(stext) If IsNumeric(Mid(stext, j, 1)) Or IsAlpha(Mid(stext, j, 1)) Then letter1 = Mid(stext, j, Len(stext)) Exit For End If Next j '''some more code''' end sub i am walking through line by line. as soon as the macro g...

SMS connecting to a phone from C# and getting a response

I wrote code to send an SMS using my GSM phone which is attached to the computer through COM port. The code is below. The problem is I do see that it is in the outbox of the phone and it actually appears to have been sent, but when I contact the recipient they say that I have not received the message. I test the phone, and I create and...

I want to trace logs using a Macro multi parameter always null. problem c++ windows

I am using the following way to cout a function's time: #define TIME_COST(message, ...)\ char szMessageBuffer[2048] = {0};\ va_list ArgList;\ va_start(ArgList, message);\ vsprintf_s(szMessageBuffer, 2048, message, ArgList);\ va_end(ArgList); \ string strMessage(szMessageBuffer);\ CQLogTimer t(strMessage); // CQLogTimer is a sel...

What's the C strategy to "imitate" a C++ template ?

After reading some examples on stackoverflow, and following some of the answers for my previous questions (1), I've eventually come with a "strategy" for this. I've come to this: 1) Have a declare section in the .h file. Here I will define the data-structure, and the accesing interface. Eg.: /** * LIST DECLARATION. (DOUBLE LINKED LI...

Sharing visual studio macro's with team members

Is it possible to add visual studio macro's to a solution, so they would be checked in by svn ? If not, how do you deploy your utilities/scripts with your developer team ? ...

Conditional macro expansion

Heads up: This is a weird question. I've got some really useful macros that I like to use to simplify some logging. For example I can do Log(@"My message with arguments: %@, %@, %@", @"arg1", @"arg2", @"arg3"), and that will get expanded into a more complex method invocation that includes things like self, _cmd, __FILE__, __LINE__, etc...

Controlling a browser from Python

I am looking for a way to control a browser from Python, i.e. fill out form fields and submit them, possibly call JS functions. I've looked around a bit, but as far as I could see PyWebKitGtk only lets you show the browser as a GUI element, not interface with it. Is there a way to do this easily? I wrote my program logic in Python, an...

Determine when using the VC90 compiler in VS2010 instead of VS2008?

Is there a (Microsoft-specific) CPP macro to determine when I'm using the VC9 compiler in Visual Studio 2010 as opposed to Visual Studio 2008? _MSC_VER returns the compiler version, so with VS2010 multi-targeting feature, I'll get the same result as with VS2008. The reason for wanting to know the difference is that I created a new VS20...

visual studio macro to execute a file from the solution

I wrote a small tool which sits in my solution (as a project), which runs in the background and helps me debug my main project. I'd like to run the tool with a macro but I haven't found how to get the build path and execute it in the background. Any VB macro experts ? ...

Conditional value for a #define

I want to define a macro kDependentMacro to be 38 if the macro kIndependentMacro is defined and 40 otherwise. What is the simplest way to do that? ...

Optional Parameters with C++ Macros

Hey there, Is there some way of getting optional parameters with C++ Macros? Some sort of overloading would be nice too. It doesnt seem as if there is? I couldnt find any method anyway. Thanks in advance! ...

What is the logic behind defining macros inside a struct?

As apparent in the title, I'm questioning the reason behind defining the macros inside a struct. I frequently see this approach in network programming for instance following snippet: struct sniff_tcp { u_short th_sport; /* source port */ u_short th_dport; /* destination port */ tcp_seq th_seq; ...

How do I save a macro consisting of multiple search and replace into my .vimrc

I have a macro that I use to replace special characters for its html entities. I would like to save it in my .vimrc. According to this, I should use let @r=' *macro_text_goes_here* '. The problem is that my macro is a series of search and replace, something like this: :%s:á:\á:Ige :%s:é:\é:Ige :%s:í:\í:Ige So, I'...

Equivalent of `__FILE__`, `__LINE__` in bash

Is there any variable in bash that contains the name of the .sh file executed ? The line number would be great too. I want to use it in error messages such as: echo "ERROR: [$FILE:L$LINE] $somefile not found" Thank you ...

excel quotes in formula question

i have a column with this data: IT_AMPH IT_BARB IT_BENZ IT_BUP SOMA i want the column next to it to be literarely =like "*,IT_AMPH,*" =like "*,IT_BARB,*" =like "*,IT_BENZ,*" etc please note that i want the equal signed to be displayed, exactly as shown above what would be the formula for this? ...

Speed up an Excel Macro?

Right now I have a macro PopulateYearlyValues But it seems to me it's taking way too long Sub PopulateYearlyValues(ByVal Month As Range) Dim c As Double Dim s As Double c = Application.WorksheetFunction.Match(UCase(Month.Value), ActiveSheet.Range("AA5:AX5"), 0) s = (ActiveSheet.Range("AA5").Column - 1) With ActiveShe...

generating method name in a macro

Hi, I need to automatically prepend method name to some logging messages. I've been using __FUNCTION__ to do it but it generates the fully qualified name of the method ( namespace::class:method ). So it's wasting a lot of space and makes logs less readable. Is there any way to append only the method name in a MACRO, without any unneces...

unconventional sorting in excel

i have a list like this: G05 G03 F02 F06 G10 A03 A11 E10 E05 C11 C03 D03 A12 C12 F05 H03 C08 G02 D10 B12 C10 D11 C02 E11 E02 E03 H11 A08 D05 F04 A04 H07 D04 B07 F12 E04 B03 H05 C06 F08 C09 E08 G12 C04 B05 H09 A07 E09 C07 G07 G09 A06 D09 E07 E12 G04 A10 H02 G08 B06 B09 D06 F07 G06 A09 H06 D07 H04 H10 F10 B02 B10 F03 F11 D08 B11 B08 D12 H...

When did the idea of macros (user-defined code transformation) appear?

I have read McCarthy's 1960 paper on LISP and found no reference to anything that's similar to user-defined macros or normal order evaluation. I was wondering when marcos first appeared in programming language history (and also in Lisp history): When was the idea of user-defined code transformation (before interpretation or compilation...

How to loop though a table and access row items by their column header?

I have the following macro which needs to loop though an Excel-2007 table. The table has several columns and I am currently finding the correct column position using the Index property columns. Using the index is the only way I could find to correctly index into the fName object. The better option I am hoping for is to access specific c...