Debug one function only in liteIDE (golang) - debugging

I was wondering if it is possible inside liteIDE to run only one function, using some parameters, and see what a variable contains after executing one specific code line.
Thanks.

Indeed, I could (and should !) write a test for it.
And for seeing what a variable contains at some step in the execution, either:
debug-print it inside the function, then run the test
Use a debugger (for go it's called delve) and step through either the test or the real program

Related

How can I run only one ui-test from fastlane?

how can I run only one ui-test by XCTest from fastlane?
I know about parameters for fastlane: only_testing but not understood how to use this.
Can you give an example
I run my all ui-tests as:
fastlane ios RunningUITests
but want fastlane ios RunningUITests only_testing:GTUITests/GT00FirstClass/testFunc
this not work for me
Can you give an exactly example for this?
You have to use the scan (also known as run_tests) "action". Read this documentation for information.
There, you can see the instructions for calling it directly on the command line. In your example it would be:
fastlane scan --workspace "<YourRunningUITests>.xcworkspace" --scheme "<YourRunningUITestsScheme>" --only-testing "GTUITests/GT00FirstClass/testFunc"
Replace the values inside of the angled brackets (< >) with the values appropriate to your code.
However, rather than running that multi-parameter call from the command line, I recommend using a Fastfile to consolidate your logic and allow you to perform more sophisticated logic (such as these Fastfiles).
If you were to follow the logic suggested here, you could then simply call fastlane tests from the command line. Much simpler.
The comment from above is very useful, the only thing I want to add is that if you want to run more tests, write something like the following:
--only-testing "GTUITests/GT00FirstClass/testFunc,GTUITests/GT00FirstClass/testFunc2"
You should always write the full path to the test function

How to test my dll file written in fortran?

I have written a Fortran code for being compiled as a '*.DLL' file.
The program which reads that file is a Finite Elements Method software named Plaxis, I already achieved to generate the '*.DLL' file in Visual Studio and Plaxis recognizes my model but the model does not work fine.
I would like to evaluate all the variables involved in my code and the procedure that Plaxis is using to read them, but when I use commands like "write(*,*) 'variable'" Plaxis does not show me what I asked in the source code.
Probably you want to open a file and write to that for debug logging, because presumably Plaxis doesn't run with standard output connected to anything useful. Or maybe it would if you just ran Plaxis from a command line window?
It's not going to create a dialog box for you.
But anyway, another option would might be attach to Plaxis with a debugger, and set a breakpoint in a function in your DLL. Then you can single-step your code as called by Plaxis.
Or you can write your own test callers and write unit tests for your functions, making them easy to debug. This could work well if your function just gets an array + size as args.
If instead it passes some wrapped object that you need to call special functions to deal with, then maybe make another version of your function that does just take an array so you can call it from a simple test caller.

Ruby debugging: how to step over inline breakpoints

How to step over pieces of single line while debugging in ruby?
What I'm looking for - is ability to step by commands while executing line, move over line parts, calling its separate methods, function by function. Ability to separately step over multiple functions in line.
Like in javascript (screenshot from Chrome console):
For example, here I don't need to step into previously chained method call all(promises), but need to go right into then.
Seems to be essential functionality for modern programming language, though can't find how to do it in ruby. For now I have to step into each function in line and finish it's execution to trap into next function call - repeating it till I get into needed chained function - it's monkey job now :).
Disclaimer: There could be opinions, that I could avoid methods chaining, but it is convenient. (Generally, looking for convenient ways of work and tools for it)
Debug library which allows to step into function by name with step func_name:
https://github.com/garmoshka-mo/pry-moves
here s is shortcut for step

Write to Chef::Log from a template script?

I work on a team that decided long ago to use Chef's template resource to make dynamic scripts to be executed in an execute reource block.
I know this feature was only built to generate config files and the like, but I have to work with what I've got here.
Basically I need to know how to write to Chef::Log from a Ruby script generated from a template block. The script is not in the same context as the cookbook that generated it, so I can't just call require 'chef/log' in the script. I also do not want to just append the chef-run.log because that runs into timing problems.
Is there any way to accomplish this as cleanly as possible without appending to chef-run.log?
Thank you for your time.
Chef::Log is a global, so technically you can just call its methods directly from inside a template, but this is really weird and you probably shouldn't. Do whatever logging you need from the recipe code instead. If you need to log some values, compute them in the recipe and them pass them in using variables.

Inconsistency running a clojure jar from command line

I have a clojure program that at some point executes a function called db-rebuild-files-table.
This function takes a directory filename as a single string argument and calls a recursive function that descends into the directory file tree, extracts certain data from the files there and logs each file in a mysql database. The end result of this command is a "files" table populated by all files in the tree under the given directory.
What I need is to be able to run this command periodically from the shell.
So, I added the :gen-class directive in the file containing my -main function that actually calls (db-rebuild-files-table *dirname*). I run lein uberjar and generate a jar which I can then execute with:
java -jar my-project-SNAPSHOT-1.0.0-standalone.jar namespace.containing.main
Sure enough, the function runs, but in the database there only exists a single entry, for the directory *dirname*. When I execute the exact same sexp in the clojure REPL I get the right behaviour: all the file tree under *dirname* get processed.
What am I doing wrong? Why does the call (db-rebuild-files-table *dirname*) behave inconsistently when called from the REPL and when executed from the command line?
[EDIT] Whats even weirder is that I get no error anywhere. All function calls seem to work as they should. I can even run the -main function in the REPL and it updates the table correctly.
If this works in the REPL, but not when executed stand-alone, then I would guess that you may be bitten by the laziness of Clojure.
Does your code perhaps need a doseq in order to get the benefits of a side-effect (e.g. writing to your database)?
Nailed it. It was a very insidious bug in my program. I got bitten by clojure's laziness.
My file-tree function used map internally, and so produced just the first value, the root directory. For some reason I still can't figure out, when executed at the REPL, evaluation was actually forced and the whole tree seq was produced. I just added a doall in my function and it solved it.
Still trying to figure why executing something at the REPL forces evaluation though. Any thoughts?

Resources