Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Macro



  Learn Emacs: Keyboard Macros

An emacs keyboard macro is just a recording of user input into emacs, which means that most anything you can do in emacs can be recorded as a macro. Read that again. Pretty powerful.Here’s how it works. To start recording, typeC-x (and input the commands in your macro. Then typeC-x )to stop recording. Then typeC-x eto apply the macro once, orC-u 0 C-x eto apply the macro until the bell rings or end of buffer is reachedKeep in mind that you must not ring the bell when defining a keyboard m...

   Emac,Macro,Code,Example     2011-11-10 10:45:47

  Macro to change text color conditionally in Excel

Macros are small but very powerful VBA programs in Microsoft Office software. They can help us complete some repeated tasks automatically. Today, I will show you one macro example which is to change the text color conditionally. The excel file has a work sheet which contains some records of request. I want to check the status of each request, if the status of a request is approved, the text color of the status should be green; if the status of a request is rejected, the text color of the status ...

   Macro,Excel,Text color,Conditionally     2012-07-07 12:53:28

  do {...} while (0) in macros

If you are a C programmer, you must be familiar with macros. They are powerful and can help you ease your work if used correctly. However, if you don't define macros carefully, they may bite you and drive you crazy. In many C programs, you may see a special macro definition which may seem not so straightforward. Here is one example: #define __set_task_state(tsk, state_value) \ do { (tsk)->state = (state_value); } while (0) There are many this kind of macros which uses do{...}while(0)...

   C,macro,C++     2014-01-23 07:16:13

  C Preprocessor Hell

Lisp programmers should stop reading right now because they'll likely suffer severe injury of the jaw muscles as they laugh themselves silly at how hard it is to do some things in C. The C language has a pre-processor (typically called cpp) that is both infuriating and powerful. How powerful is usually best described as 'just too little' and it has happened more than once that I found myself almost - but not quite - able to do what I wanted to do. The frustration can run very deep at ti...

   C,Preprocessor,Lisp,Hell     2012-01-19 10:22:31

  Office 2013 RT for Windows RT tablets may rule out macros and VBA

Office 2013 RT is the office suite optimized for Windows RT system running on ARM tablet PC, Microsoft plans to release a preview version later this year. However, according to TheVerge, Microsoft may remove some features in this version of the Office suite.The so-called optimization, certainly require some changes to Office based on ARM tablet architecture. To remove some features may be because of battery life and machine reliability considerations. Macrso, third-party add-ons, and VBA will be...

   Office 2013,Macro,Window RT     2012-08-07 14:17:53

  Scala Macros

This is the home page of project Kepler, an ongoing effort towards bringing compile-time metaprogramming to Scala. Our flavor of macros is reminiscent of Lisp macros, adapted to incorporate type safety and rich syntax. Unlike infamous C/C++ preprocessor macros, Scala macros: 1) are written in full-fledged Scala, 2) work with expression trees, not with raw strings, 3) cannot change syntax of Scala. You can learn more about our vision of metaprogramming from our talks. We propose to enrich Scala ...

   Scala,Macro,Efficiency,Maintainebility     2012-02-01 00:12:15

  Lisp: It's Not About Macros, It's About Read

Note: the examples here only work with outlet lisp. Refer to your version of lisp/scheme’s documentation for how read works (and possibly other forms) I know it’s an old post by now, but something about the article Why I love Common Lisp and hate Java, part II rubbed me the wrong way. The examples just aren’t that good. The usage of macros is plain baffling, when a function would have been fine. The author admits this, but still does it. There’s a follow-up post wh...

   Lisp,Macro,Read,Java     2012-02-19 06:12:19

  Preprocessor magic:Default Arguments in C

This post is for programmers who like C or for one reason or another can't use anything else but C in one of their projects. The advantages of having default arguments is not something that needs convincing. It's just very nice and convenient to have them. C++ offers the ability to define them but C under the C99 standard has no way to allow it. In this post I will detail two ways I know of implementing default arguments in C. If a reader happens to know additional ways please share in ...

   C,Preprocessor,Default arguments     2012-02-19 06:17:04

  The ugliest C feature:

<tgmath.h> is a header provided by the standard C library, introduced in C99 to allow easier porting of Fortran numerical software to C. Fortran, unlike C, provides “intrinsic functions”, which are a part of the language and behave more like operators. While ordinary (“external”) functions behave similarly to C functions with respect to types (the types of arguments and parameters must match and the restult type is fixed), intrinsic functions accept arguments of...

   C,,Fortran,Intrinsic functions,C99,Ugly     2011-12-26 08:33:27

  Significance and use of do{...}while(0)

In some Linux kernel and other open source codes, we can see some codes like below: do{ ... }while(0) This code snippet is not a loop, it seems there is no significance of using do...while this way, then why should we use it? In fact, the significance of do{...}while(0) is better than optimizing your code. After some research, we summarize some benefits of it. 1. Help define complex macro to avoid error #define DOSOMETHING()\ foo1();\ foo2(); The me...

   do{...}while(0), optimization     2012-10-21 21:13:22