Search Results

Search found 786 results on 32 pages for 'macros'.

Page 12/32 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • SOLVED: Lisp: macro calling a function works in interpreter, fails in compiler (SBCL + CMUCL)

    - by ttsiodras
    As suggested in a macro-related question I recently posted to SO, I coded a macro called "fast" via a call to a function (here is the standalone code in pastebin): (defun main () (progn (format t "~A~%" (+ 1 2 (* 3 4) (+ 5 (- 8 6)))) (format t "~A~%" (fast (+ 1 2 (* 3 4) (+ 5 (- 8 6))))))) This works in the REPL, under both SBCL and CMUCL: $ sbcl This is SBCL 1.0.52, an implementation of ANSI Common Lisp. ... * (load "bug.cl") 22 22 $ Unfortunately, however, the code no longer compiles: $ sbcl This is SBCL 1.0.52, an implementation of ANSI Common Lisp. ... * (compile-file "bug.cl") ... ; during macroexpansion of (FAST (+ 1 2 ...)). Use *BREAK-ON-SIGNALS* to ; intercept: ; ; The function COMMON-LISP-USER::CLONE is undefined. So it seems that by having my macro "fast" call functions ("clone","operation-p") at compile-time, I trigger issues in Lisp compilers (verified in both CMUCL and SBCL). Any ideas on what I am doing wrong and/or how to fix this?

    Read the article

  • How can you make an emacs macro wait for cscope query results?

    - by Sudhanshu
    I am trying to write a macro which calls cscope-find-functions-calling-this-function on each and every tag in a file displayed in the *Tags List* buffer (created by list-tags command). This should create a buffer which contains list of all functions calling a set of functions defined in a certain file. This is the sequence of keystrokes: 1. <f11> ;; cscope-find-functions-calling-this-function 2. RET ;; newline [shows results of cscope in a split window] 3. C-x C-p ;; mark-page 4. C-x C-x ;; icicle-exchange-point-and-mark 5. <up> ;; previous-line 6. <end> ;; end-of-line [region to copy has been marked] 7. <f7> ;; append-results-to-buffer 8. C-x ESC O ;; [move back to split window on the right] 9. C-x b ;; icicle-buffer [Switch back to *Tags List* buffer] 10. *Tags ;; self-insert-command * 5 11. SPC ;; self-insert-command 12. List* ;; self-insert-command * 5 13. RET ;; newline 14 . <down> ;; next-line [Position point on next tag in the list] Problem: I get no results in the buffer, and I found out that's because Step 3-7 execute even before cscope prints the results of query made on Steps 1-2. I can insert a pause in the macro by using C-x q, but I'd rather like the macro to wait after Step 2, until cscope has returned with the results and only then continue further. I suspect this is not possible through a macro, maybe a LISP function... I'm not a lisp expert myself. Can someone please help? Thanks! Details: I have Icicles installed so by default I get word at point in current buffer as input in minibuffer. F11 is bound to cscope-find-functions-calling-this-function windmove is installed and C-x (C-x ESC o - as shown below) takes you to the right window. F7 is bound to append-results-to-buffer which is defined as: (defun append-results-to-buffer () (interactive) (append-to-buffer (get-buffer-create "c1") (point) (mark))) This function just appends the currently marked region to a buffer named "c1".

    Read the article

  • excel vba: return values only if they are not present in current column

    - by every_answer_gets_a_point
    i have a column to which i am adding data from another column i would like to check whether that column has the data that i wish to add. can you help me wiht a formula that will tell me whether a certain value exists in the current column? please keep in mind it is a bit more complex than it sounds. currently i have this in the cell: =IF(OR(A3="ETG_C",A3="ETGC"),C3,"na") i would like to have something like this =IF(FIND(IF(OR(A2="ETG_C",A2="ETGC"),C2,"na"),K:K,1)," ",IF(OR(A2="ETG_C",A2="ETGC"),C2,"na")) another words, if the top value exists already, then add a blank space

    Read the article

  • Creating a context in custom shoulda macro does not work.

    - by Honza
    I have a custom should macro in my test_helper.rb which looks like this. def self.should_require_login(actions = [:index]) if (actions.is_a? Symbol) actions = [actions] end context "without user" do actions.each do |action| should "redirect #{action.to_s} away" do get action assert_redirected_to login_path end end end if block_given? context "active user logged in" do setup do @user = Factory.create(:user) @user.register! @user.activate! login_as(@user) end yield end end end I would like to use it like this: should_require_login(:protected_action) do should "do something" do ... end end And I am expecting the "do something" test to run in the "active user logged in" context, but the test executes in the top context, like the "active user logged in" context never existed and I fail to see the reason why.

    Read the article

  • Looping through macro Varargs values

    - by Ed Marty
    If I define some macro: #define foo(args...) ({/*do something*/}) Is there some way to actually loop through args rather than pass it along to another function? Something like #define foo(args...) \ { \ for (int i = 0; i < sizeof(args); ++i) { \ /*do something with args[i]*/ \ } \ }

    Read the article

  • exec() in BeanShell macro causes jEdit to hang when it returns non-zero exit code

    - by rossmeissl
    I have a jEdit BeanShell macro that runs my Markdown files through Maruku when I save them: if (buffer.getMode().toString().equals("markdown")) { cmd = "C:\\Ruby\\bin\\maruku.bat -o " + buffer.getDirectory() + buffer.getName().replaceAll("markdown$", "html") + " " + buffer.getPath(); exec(cmd); } This works great when the Markdown file is valid. But if I've made a mistake, jEdit just waits around forever for the exec() call to "succeed," which it never will. When this happens, I have to kill jEdit's javaw.exe process and run Maruku manually from the command line to discover the error, e.g.: E:\bp\plan\supply_chain>maruku business_plan.markdown ___________________________________________________________________________ | Maruku tells you: +--------------------------------------------------------------------------- | Could not find ref_id = "17" for md_link(["17"],"17") | Available refs are [] +--------------------------------------------------------------------------- !C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/errors_management.rb:49:in `maruku_error' !C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:716:in `to_html_link' !C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in `send' !C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in `array_to_html' !C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:961:in `each' \___________________________________________________________________________ Not creating a link for ref_id = "17". Then I restart jEdit, fix the error, and re-save the file, at which point the macro succeeds. How can I make my macro more resilient to either die helpfully (display Maruku's error output) or, at the very least, die silently so I don't have to kill jEdit?

    Read the article

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

    - by Dan
    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 VS2010 project which contains code removed from a larger project. I just left the VS2008 stuff "as is" since we're moving away from VS2008 "soon" anyway and I didn't want to go through the hassle of creating a vcproj file along with the new vcxproj. For now, I've just defined my own macro to indicate whether the code is compiled into its own DLL or not; it works just fine, but it would be nice if there were something slightly more elegant.

    Read the article

  • Pros and Cons of Different macro function / inline methods in C

    - by Robert S. Barnes
    According to the C FAQ, there are basically 3 practical methods for "inlining" code in C: #define MACRO(arg1, arg2) do { \ /* declarations */ \ stmt1; \ stmt2; \ /* ... */ \ } while(0) /* (no trailing ; ) */ or #define FUNC(arg1, arg2) (expr1, expr2, expr3) To clarify this one, the arguments are used in the expressions, and the comma operator returns the value of the last expression. or using the inline declaration which is supported as an extension to gcc and in the c99 standard. The do { ... } while (0) method is widely used in the Linux kernel, but I haven't encountered the other two methods very often if at all. I'm referring specifically to multi-statement "functions", not single statement ones like MAX or MIN. What are the pros and cons of each method, and why would you choose one over the other in various situations?

    Read the article

  • How to deprecate a macro in GCC?

    - by Eric
    Hi, i Know how to use attribute deprecated to deprcate a function like this: int old_fn () __attribute__ ((deprecated)); But how to deprecate a Macro like this: #define OLD_MACRO 1 Thank you in advance. Eric

    Read the article

  • Scala model-view-presenter, traits

    - by Ralph
    I am a fan of Martin Fowler's (deprecated) model-view-presenter pattern. I am writing a Scala view class containing several button classes. I would like to include methods to set the action properties of the buttons, to be called by the presenter. A typical code fragment looks like this: private val aButton = new JButton def setAButtonAction(action: Action): Unit = { aButton.setAction(action) } This code is repeated for each button. If Java/Scala had the C preprocessor, I would create a macro to generate this code, given the button name (no lectures on the evils of the C preprocessor, please). This code is obviously very verbose and repetitive. Is there any better way way to do this in Scala, perhaps using traits? Please hold the lectures about scala.swing. I looking for a general pattern here.

    Read the article

  • Visual Studio 2008 Macro for Building does not block thread

    - by Climber104
    Hello, I am trying to write a macro for Building my application, kicking off an external tool, and ataching the debugger to that external tool. Everything is working except for the building. It builds, but it is not blocking the thread so the external tool gets kicked off before it can finish. Is there a way I can run ExecuteCommand and wait for the thread to finish? Code is below: DTE.ExecuteCommand("ClassViewContextMenus.ClassViewProject.Build") DTE.ExecuteCommand("Tools.ExternalCommand11") Try Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default") Dim dbgeng(1) As EnvDTE80.Engine dbgeng(0) = trans.Engines.Item("Managed") Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, "MINIPC").Item("_nStep.exe") proc2.Attach2(dbgeng) Catch ex As System.Exception MsgBox(ex.Message) End Try

    Read the article

  • Best IDE macro tools to combat the verbosity of Java syntax for someone with carpal tunnel?

    - by Carlsberg
    I have a bad case of carpal tunnel so I'm looking for an editor that would make my Java programming less painful (literally!). Does anyone have any recommendations for tools that you can add to Eclipse, Netbeans or other IDEs to produce some of the repetitive code that's common in Java syntax? Overall what would be the best code editor for this purpose? (I'm coding on Ubuntu, in case it matters).

    Read the article

  • Extract the vb code associated with a macro attached to an Action button in PowerPoint

    - by Patricker
    I have about 25 PowerPoint presentations, each with at least 45 slides. On each slide is a question with four possible answers and a help button which provides a hint relevant to the question. Each of the answers and the help button is a PowerPoint Action button that launches a macro. I am attempting to migrate all the questions/answers/hints into a SQL Database. I've worked with Office.Interop before when working with Excel and Word and I have plenty of SQL DB experience, so I don't foresee any issues with actually extracting the text portion of the question and answer and putting it into the db. What I have no idea how to do is given an object on a slide - get the action button info - Get the macro name - and finally get the macro's vb code. From there I can figure out how to parse out which is the correct answer and what the text of the hint is. Any help/ideas would be greatly appreciated. The guy I'm doing this for said he is willing to do it by hand... but that would take a while.

    Read the article

  • How to write (simple) macro?

    - by krzysz00
    I need to write a macro (with-hooks (monster method who what) &body body) for a game I'm writing. Monster is a CLOS object, method and who are strings and what is a function (#' notation). The macroexpansion would be something to the effect of (add-hook monster method who what) ,@body (remove-hook monster method who) I have absolutely no idea how to write such a macro, and I would appreciate some help.

    Read the article

  • Xcode/GCC predefined macro for target name?

    - by Justicle
    I was wondering if there is an Xcode or GCC preprocessor symbol for the target name of the application. For example if I'm building an application called "MonkeyChicken", is there a preprocessor symbol such that printf( __TARGET_NAME__ ) outputs: MonkeyChicken

    Read the article

  • Script/plugin to update web page (load next 25 comments) until page fully loaded

    - by Carl
    Brief summary: I need a script/plugin for Firefox that selects the "load next 25 comments" link at the bottom of a web page, until that link is no longer on the page. As you click that link - you get more comments - eventually all of them on the same page. See this web page for an example (there are 1,852 comments): http://www.cnn.com/2010/US/05/16/gulf.oil.spill/index.html#comment-50598247 I have a regular problem with CNN.com. I post comments there. People sometimes reply to them. I check my profile, and see the number of replies, but I can't read them there. I have to follow the link to the original article. The fist set of comments are at the bottom, with a 'load next 25' link at the bottom. There are often hundreds of comments, and sometimes a few thousand. There is no practical way for me to read the replies to my comments. If there's under around 300 hundred, I'll just click that link enough times to see what the replies to my comments are. I need a script/plugin to select that 'load next 25' link until that link is no longer present on the page. Then I could just search for my userid and read the responses.

    Read the article

  • Macro and array crossing

    - by Thomas
    I am having a problem with a lisp macro. I would like to create a macro which generate a switch case according to an array. Here is the code to generate the switch-case: (defun split-elem(val) `(,(car val) ',(cdr val))) (defmacro generate-switch-case (var opts) `(case ,var ,(mapcar #'split-elem opts))) I can use it with a code like this: (generate-switch-case onevar ((a . A) (b . B))) But when I try to do something like this: (defparameter *operators* '((+ . OPERATOR-PLUS) (- . OPERATOR-MINUS) (/ . OPERATOR-DIVIDE) (= . OPERATOR-EQUAL) (* . OPERATOR-MULT))) (defmacro tokenize (data ops) (let ((sym (string->list data))) (mapcan (lambda (x) (generate-switch-case x ops)) sym))) (tokenize data *operators*) I got this error: *** - MAPCAR: A proper list must not end with OPS. But I don't understand why. When I print the type of ops I get SYMBOL I was expecting CONS, is it related? Also, for my function tokenize how many times the lambda is evaluated (or the macro expanded)?

    Read the article

  • Updating target workbook - extracting data from source workbook

    - by Allan
    My question is as follows: I have given a workbook to multiple people. They have this workbook in a folder of their choice. The workbook name is the same for all people, but folder locations vary. Let's assume the common file name is MyData-1.xls. Now I have updated the workbook and want to give it to these people. However when they receive the new one (let's call it MyData-2.xls) I want specific parts of their data pulled from their file (MyData-1) and automatically put into the new one provided (MyData-2). The columns and cells to be copied/imported are identical for both workbooks. Let's assume I want to import cell data (values only) from MyData-1.xls, Sheet 1, cells B8 through C25 ... to ... the same location in the MyData-2.xls workbook. How can I specify in code (possibly attached to a macro driven import data now button) that I want this data brought into this new workbook. I have tried it at my own location by opening the two workbooks and using the copy/paste-special with links process. It works really well, but It seems to create a hard link between the two physical workbooks. I changed the name of the source workbook and it still worked. This makes me believe that there is a "hard link" between the tow and that this will not allow me to give the target (MyData-2.xls) workbook to others and have it find their source workbook.

    Read the article

  • Putting together CSV Cells in Excel with a macro

    - by Eric Kinch
    So, I have a macro to export data into CSV format and it's working great (Code at the bottom). The problem is the data I am putting into it. When I put the data in question in it comes out Firstname,Lastname,username,password,description I'd like to change it so I get Firstname Lastname,Firstname,Lastname,username,password,description What I'd like to do is manipulate my existing macro so to accomplish this. I'm not so good at VBS so any input or a shove in the right direction would be fantastic. Thanks! Sub Make_CSV() Dim sFile As String Dim sPath As String Dim sLine As String Dim r As Integer Dim c As Integer r = 1 'Starting row of data sPath = "C:\CSVout\" sFile = "MyText_" & Format(Now, "YYYYMMDD_HHMMSS") & ".CSV" Close #1 Open sPath & sFile For Output As #1 Do Until IsEmpty(Range("A" & r)) 'You can also Do Until r = 17 (get the first 16 cells) sLine = "" c = 1 Do Until IsEmpty(Cells(1, c)) 'Number of Columns - You could use a FOR / NEXT loop instead sLine = sLine & """" & Replace(Cells(r, c), ";", ":") & """" & "," c = c + 1 Loop Print #1, Left(sLine, Len(sLine) - 1) 'Remove the trailing comma r = r + 1 Loop Close #1 End Sub

    Read the article

  • MACRO compilation PROBLEM

    - by wildfly
    i was given a primitive task to find out (and to put in cl) how many nums in an array are bigger than the following ones, (meaning if (arr[i] arr[i+1]) count++;) but i've problems as it has to be a macro. i am getting errors from TASM. can someone give me a pointer? SortA macro a, l LOCAL noes irp reg, <si,di,bx> push reg endm xor bx,bx xor si,si rept l-1 ;;also tried rept 3 : wont' compile mov bl,a[si] inc si cmp bl,arr[si] jb noes inc di noes: add di,0 endm mov cx,di irp reg2, <bx,di,si> pop reg2 endm endm dseg segment arr db 10,9,8,7 len = 4 dseg ends sseg segment stack dw 100 dup (?) sseg ends cseg segment assume ds:dseg, ss:sseg, cs:cseg start: mov ax, dseg mov ds,ax sortA arr,len cseg ends end start errors: Assembling file: sorta.asm **Error** sorta.asm(51) REPT(4) Expecting pointer type **Error** sorta.asm(51) REPT(6) Symbol already different kind: NOES **Error** sorta.asm(51) REPT(10) Expecting pointer type **Error** sorta.asm(51) REPT(12) Symbol already different kind: NOES **Error** sorta.asm(51) REPT(16) Expecting pointer type **Error** sorta.asm(51) REPT(18) Symbol already different kind: NOES Error messages: 6

    Read the article

  • Need to copy columns H,K,L From one excel workbook to new workbook using Excel Macro

    - by bhargav reddy
    I have a excel workbook A.xlsx with columns A through T, now i need to copy specific columns H,K,L to a new workbook which would be created while i run a macro. I was able to successfully copy a range of columns from one worksheet to another, but i am not finding a way to copy specific columns to a new workbook. Private Sub copy_sub() Sheets("Sheet1").Columns("H:K").Copy Sheets("Sheet2").Range("A1") End Sub

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >