WinDbg: .for loop to execute commands X number of times? - windbg

I want to to "t" (trace) and "dds #esp" X number of times.
.for (r $t0=0; #$t0<10; r $t0=#$t0+1){t;dds #esp;}
I tried the above and it doesn't work - it only does the "dds #esp" 10 times.
to try to narrow it down, I tried:
.for (r $t0=0; #$t0<10; r $t0=#$t0+1){t}
but get the followign error:
^ Debuggee already running error in 't'
Can someone assist me with this? Also are there any guides for learning these scripts from a rookie perspective?
Thanks.

Related

Subtraction broken in Visual Studio Code (always returns 10)

I am new to both Julia and Visual Studio.
whenever I try to subtract two numbers
i.e. 3 - 5 I get 10
I am however able to add a negative number
3 + - 5 gives -2 as expected
The behavior also occurs with the .- and .+ operators. I thought there might be something wrong with my "-" character so I tried copying and pasting from the julia page on mathematical operators (https://docs.julialang.org/en/v1/manual/mathematical-operations/) to no avail.
I was unable to find any one else with the same problem. The problem appears to be limited to Visual studio as subtraction still works fine when I run Julia in terminal.
I am using Visual Studio Code 1.71.2 with the julialang 1.7.12 extension and Julia 1.8.1
EDIT-1:
If I copy and paste the code from Visual Studio Code into the julia terminal (not terminal in VSC) it works. However, if I run the code using julia the-script.jl in the terminal I still get 10 for any subtractions performed. I have also tested editing the script with nano and then running it and I am encountering the same problem.
EDIT3: As was pointed out by several responders the issue was not with VS code
Thank you for your help
Could someone explain where my code is breaking the function -?
I am unable to reliably break it so that I get 10 whenever I try and subtract, but I have been able to reproduce the error with the above script
# #make the neutral model that I have in R in julia and benchmark both models
# #imports
using Random
# #set the seed
Random.seed!(125)
#set the initial arguments
num_sp_local = 10::Int64;
init_sp_abundance = 100::Int64;
mig_prob = 0.01::Float64;
#meta community is uniform
num_sp-meta = 10; #ERROR IS HERE - function redefined to be 10
#the number of time steps to run the sim for
time_steps = 100000;
for i = 1:50
println(i - 35)
end
The error can be seen above num_sp-meta = 10; redefines the - function to be 10 irrespective of what is being subtracted.
This has nothing to do with VS Code, changing your editor/IDE is a pointless waste of time.
As #JoachimSauer suggested, someone (maybe you?) has re-defined the - function in your Julia instance.
Try fixing - by resetting it to Base.- like this: -(x::Int, y::Int) = Base.:-(x, y)
That might not work, depending on how the change was originally done.
Restart the REPL in VS Code. Perhaps the redefinition happened inside the script. Try to run 2 - 3, without running the-script first. This should work now.
This means that the change happened inside the-script.jl. Look for redefinitions of - inside that file.
If the above still doesn't work, the problem lies in some other library or script which is run. If so, try starting Julia like this:
julia --startup-file=no
and then run 2 - 3 or something like that.

Notepad++: Record macro will not remember steps taken within Column Editor

I'm trying to remove duplicates in an document. This includes both of entries it finds without moving the order of the entries.
Example
A
B
C
Random info
B
C
Results
A
Random info
I found how to do that via this link and following Method 2. Problem is when recording the macro it doesn't record steps I take when using Column editor. Does anyone know how to fix this or a different method? Thank you
Unfortunatelly, column editor and other plugin actions cannot be recorded because of a bug in notepad++.
However, you can still achieve what you want without using column editor.
Use this macro:
Start macro recording
Control + H to launch "search & replace":
Find what: ^([^\n]*)$\R([\s\S]*?)\R?+^\1$
Replace by: \2
Replace All
Place the cursor at the first position of the file (line 0, character 0) Use the mouse or use Control + G, then 0
Stop macro recording
Now, run your macro with run a macro multiple times and select run until the end of file.
Here is a demo of the process:

how to stop matlab from running a script in mac

I know this is a duplicate but none of the answers published already are solving my problem . im using mac and trying to stop matlab runing with cmd + .
or cmd + c . pressing for long time does not help .
any suggestion?
Ctrl + C? Some heavy Matlab calls may be un-interuptable in this way, but mostly this should work.
If you don't care about the intermediate results or the content of your global workspace, you could always kill MATLAB's process.
Next time you'll run a script with huge loops, take the advice of including some function calls that will transfer briefly the control to the user interface: drawnow, getframe etc.
For Octave 4.4.1 GUI, on MacOS 10.14 Mojave, to exit code mid execution I use:
For code that is paused:
option + c
For code stuck in a loop:
control + c
You may need to hold this down for a few seconds

R - StatET Stop on Error

In R-studio the processing always stops at the error, if there any way to have this behavior in StatET/Eclipse?
Details:
When using R in Eclipse through StatET, if I run a command such as
x = 7
x = xx + x
x
via "Run Selection in R" (Ctrl + R, Ctrl + R) I get the output
> x = 7
> x = xx + x
Error: object 'xx' not found
> x
[1] 7
In this contrived example there isn't much of a problem, but with many lines of code its easy that the error message gets lost among many pages of output and that the wrong value is ultimately used in the rest of the calculations.
I've tried putting the whole thing curly braces works but this somewhat defeats the speed of having a dedicated command to run the selection. I've also tried options(error = NULL) as per this post but it doesn't fix the problem.
Many thanks.
This problem is a result of options(error = NULL). Remove that and you will get the intended behaviour.
BTW, you should use <- for assignments.

CoffeeScript : unexpected INDENT error

I am trying out CoffeeScript in my Rails 3.1 app. However, I am not able
to figure out how to break long lines in CoffeeScript without getting the
above error
For example, how/where would you break the following line of code
alert x for x in [1,2,3,4,5] when x > 2
if you wanted something like
alert x for
x in [1,2,3,4,5]
when x > 2
In my vimrc, I have set
ts=2, sw=2 and I expand tabs.
And yet, I cannot get something as simple as the line above to work properly.
My Gemfile.lock shows coffee-script-2.2.0 with coffee-script-source 1.1.3
If you have a comprehension that is too long you can break it with \ as #brandizzi mentions, but I think you might have better luck just using comprehensions where they make sense and expanding to 'regular' code where they don't:
alert x for x in [1,2,3,4,5] when x > 2
...can be rewritten as...
for x in [1,2,3,4,5]
alert x if x > 2
...or even...
for x in [1,2,3,4,5]
if x > 2
alert x
In other words, comprehensions are syntactic sugar for short, concise snippets - you don't have to use them for everything.
You're trying to spread a comprehension out over multiple lines, which isn't allowed. It either needs to be on one line, or be a proper loop. Your one line version works as expected, so I'll show the loop version:
for x in [1..5] when x > 2
alert x
You may find it helpful to toss small things like this into the CoffeeScript compiler at http://jashkenas.github.com/coffee-script/ to see if they're compiling to what you'd expect.
I do not understand the inner details of CoffeeScript syntax, so I cannot say what is going wrong in detail. The error is a bit clear, however: you cannot put a newline between the for and its iterator variable. Also, you did not get this error yet, but you cannot put a newline between the iterated object and the when clause. However, if you really want to do it, it is easy: put backslashes at the end of the first and second lines.
console.log x for \
x in [1,2,3,4,5] \
when x > 2