How to know if Octave (GUI) is busy/running - octave

It is a simple issue, but unfortunately I couldn't find the answer in any previous question. Currently, I am using Octave-6.4.0 (GUI) for simulating simple models, although I am more used to work with Matlab. Therefore, I found it really useful that Matlab shows the state "Ready" or "Busy" in the bottom-left bar. Is there something similar in Octave to check if the model has finished or if it is still running?
Thanks in advance!

The markers >> indicating that you can write a new command will only appear after the current simulation is finished.
From Tasos Papastylianou's comment:
More usefully, you might consider printing logs every now and then
during your simulation, to keep track of progress (every million
iterations, for example, or something along those lines)

Related

Gym (openAI) environment actions space depends from actual state

I'm using gym toolkit to create my own env and keras-rl to use my env within an agent.
The problem is that my actions space changes, it depends from actual state.
For example, i have 46 possible actions, but given a certain state only 7 are available, and i'm not able to find a way to modeling that.
I've read that question open-ai-enviroment-with-changing-action-space-after-each-step
but this did not resolve my problem.
In Gym Documentation there are not instructions to do this, only an issue on their Github repo (still open).
I can't understand how the agent (keras-rl, dqn agent) pick up an action, is it randomically choosen? but from where?
Can somebody help me? Ideas?
I've handled this by just ignoring any invalid actions and letting the exploration mechanics keep it from getting stuck. Quick and simple, but likely better ways to do it.
I think the better option is to somehow set the probability of selecting that action to zero, but I've had trouble figuring out how to do that.

AVR-Studio how to output?

I do not have experience with micorcontrollers but I have something related to them. Here is and explanation of my issue:
I have an algorithm, and I want to calculate how many cycles my algorithm would cost on a specific avr microcontroller.
To do that I downloaded AVR-STudio 6, and I used the simulator. I succeeded in obtaining the number of cycles for my algorithm. What I wan to know is that how can I make sure that my algorithm is working as it should be. AVR-Studio allows me to debug using the simulator but I am not able to see the output of my algorithm.
To simplify my question, I would like some help in implementing the hello world example in AVR-Studio, that is I want to see "hello world" in the output window, if that is possible.
My question is not how to program the microcontroller, my question is that how could I see the output of a program in AVR-Studio.
Many thanks
As Hanno Binder suggested in his comment:
Atmel Studio still does not provide any means to display debug messages sent by the program simulated. Your only option is to place breakpoints at apropriate locations and then inspect the state of the device in the simulator. For example the locations in RAM where your result is stored, or the registers in which it may reside; maybe have a 'watch' set on a variable or expression.
I think this is the best answer, watch vairables and memory while in debug mode.
Note: turn off optimization when you want to debug for infomation, or some variables will be optimized away.
the best thing to test if algorithms work is to run them in a regular PC program and feed them with data and compare the results with ground trouth.
Clearly to be able to do this a good programming style is neccessary that separates hardware related tasks from the actual data processing. Additionally you have to keep architectural differences in mind (eg: int=16bit vs. int=32bit --> use inttypes.h)

An autocompleting combobox

I'm trying to extend the behaviour of ttk::combobox to make it behave like the Google search box in my browser - i.e. I'd like it to drop down automatically and limit the entries in the listbox to those which match the string that I've typed in so far. Ultimately, I'd like to select the part of the string that's been autocompleted so that the next character the user types will cause it to be deleted and re-start the matching process.
I found the page on the Tcler's wiki, but that appears to select the entry with the letter just typed, which isn't what I want. (Consider a user selecting from a list of US States. When they type A, I want the selection to be limited to Alabama, Alaska, Arizona and Arkansas; when they then type an L, the list should be limited to Alabama and Alaska. The code on the wiki would select Alabama when the user types A, then Louisiana when they type L.)
I tried defining a few bindings on the ttk::combobox, but gave that up - to be honest, I can't remember why - and have tried to extend the behaviour of a ttk::entry to cover it.
After borrowing liberally from ttk/combobox.tcl I've managed to post a listbox and to limit the entries in the listbox, but am having big problems now that I've added bindings to make the up and down arrows alter the selection. To be precise, the selected item is moved happily, but some of the time when the entry widget loses focus, the whole application hangs up and my tclsh soaks up all the CPU.
I'm developing using ActiveTcl 8.6 on both Windows and Linux and the code seems to behave the same on both platforms, although I haven't tried on Linux since I first saw it not hanging in Windows. I'd be very happy to share my code, but since the demo script runs to about 450 lines, I wouldn't read it myself if someone else posted that much.
Can anyone help by asking the right question to set off a lightbulb for me? The problem feels like a timing problem, but I've no idea where to start trying to track it down.
Many thanks.
Edit I've been racking my brain, and I think the reason I abandonned the attempt to extend ttk::combobx was because there were already a large number of bindings in place, and some did things that I didn't want. The current effort uses a validatecommand on the entry widget and Key-Up, Key-Down, FocusIn and FocusOut bindings.
Current code is on pastebin here.
Well, that was embarrassing!
I took another look at the code on the wiki and discovered that it did the thing I most wanted. It doesn't post the listbox, but it does autocomplete, and if you attempt to navigate the (unposted) listbox, by pressing Key-Up or Key-Down, it starts off with the appropriate item highlighted.
That's quite enough for what I need; if I decide I really must have the listbox posted, I can see about that at the time. (Given my bad experience trying to roll my own, however, I suspect that I'll just live with this.)
Many thanks for the forebearance and suggestions.

LabView: Icon identification

I'm entirely new to LabView, and as a pet project, I'm trying to recreate a pulse detector. Thing is, the version of the .VI is LabView2010, and I can't open the.VI in LabView2009, so were trying to remake it by looking at the module. I do however, have the image, but since I'm pretty new, I can't identify some of the components used. Below is an image of the .VI, as well as, the parts I don't know encircled with red and enumerated. What exactly are these? Thanks!
To make a shift register, right click on the edge of the while loop and place a shift register. The Wait (ms) node is found in the timing functions pallet. #1 and #3 are found in the waveform generation pallet. And #2 is a waveform graph that is bound to the output of the filter. Just right click on the output of the filter and create an Indicator
I only have limited experience with the specific features in this code, so I don't have exact names, but it should point you in the right direction:
2 is a dynamic data indicator.
1 converts it to a waveform (it probably appears automatically if you hook up a DDT wire to a WF function.
3 unbundles the data from the waveform. It should be in the waveform palette.
4 is a shift register.
5 is a wait function.
In general, I would recommend that you get to learning, as you will need to understand these things to at least that level before you can be proficient.
Also, the NI forums are much more suitable for this type of question and they have many more users. I would suggest if you have such questions which you can't answer yourself, then post them there.

how are serial generators / cracks developed?

I mean, I always was wondered about how the hell somebody can develop algorithms to break/cheat the constraints of legal use in many shareware programs out there.
Just for curiosity.
Apart from being illegal, it's a very complex task.
Speaking just at a teoretical level the common way is to disassemble the program to crack and try to find where the key or the serialcode is checked.
Easier said than done since any serious protection scheme will check values in multiple places and also will derive critical information from the serial key for later use so that when you think you guessed it, the program will crash.
To create a crack you have to identify all the points where a check is done and modify the assembly code appropriately (often inverting a conditional jump or storing costants into memory locations).
To create a keygen you have to understand the algorithm and write a program to re-do the exact same calculation (I remember an old version of MS Office whose serial had a very simple rule, the sum of the digit should have been a multiple of 7, so writing the keygen was rather trivial).
Both activities requires you to follow the execution of the application into a debugger and try to figure out what's happening. And you need to know the low level API of your Operating System.
Some heavily protected application have the code encrypted so that the file can't be disassembled. It is decrypted when loaded into memory but then they refuse to start if they detect that an in-memory debugger has started,
In essence it's something that requires a very deep knowledge, ingenuity and a lot of time! Oh, did I mention that is illegal in most countries?
If you want to know more, Google for the +ORC Cracking Tutorials they are very old and probably useless nowdays but will give you a good idea of what it means.
Anyway, a very good reason to know all this is if you want to write your own protection scheme.
The bad guys search for the key-check code using a disassembler. This is relative easy if you know how to do this.
Afterwards you translate the key-checking code to C or another language (this step is optional). Reversing the process of key-checking gives you a key-generator.
If you know assembler it takes roughly a weekend to learn how to do this. I've done it just some years ago (never released anything though. It was just research for my game-development job. To write a hard to crack key you have to understand how people approach cracking).
Nils's post deals with key generators. For cracks, usually you find a branch point and invert (or remove the condition) the logic. For example, you'll test to see if the software is registered, and the test may return zero if so, and then jump accordingly. You can change the "jump if equals zero (je)" to "jump if not-equals zero (jne)" by modifying a single byte. Or you can write no-operations over various portions of the code that do things that you don't want to do.
Compiled programs can be disassembled and with enough time, determined people can develop binary patches. A crack is simply a binary patch to get the program to behave differently.
First, most copy-protection schemes aren't terribly well advanced, which is why you don't see a lot of people rolling their own these days.
There are a few methods used to do this. You can step through the code in a debugger, which does generally require a decent knowledge of assembly. Using that you can get an idea of where in the program copy protection/keygen methods are called. With that, you can use a disassembler like IDA Pro to analyze the code more closely and try to understand what is going on, and how you can bypass it. I've cracked time-limited Betas before by inserting NOOP instructions over the date-check.
It really just comes down to a good understanding of software and a basic understanding of assembly. Hak5 did a two-part series on the first two episodes this season on kind of the basics of reverse engineering and cracking. It's really basic, but it's probably exactly what you're looking for.
A would-be cracker disassembles the program and looks for the "copy protection" bits, specifically for the algorithm that determines if a serial number is valid. From that code, you can often see what pattern of bits is required to unlock the functionality, and then write a generator to create numbers with those patterns.
Another alternative is to look for functions that return "true" if the serial number is valid and "false" if it's not, then develop a binary patch so that the function always returns "true".
Everything else is largely a variant on those two ideas. Copy protection is always breakable by definition - at some point you have to end up with executable code or the processor couldn't run it.
The serial number you can just extract the algorithm and start throwing "Guesses" at it and look for a positive response. Computers are powerful, usually only takes a little while before it starts spitting out hits.
As for hacking, I used to be able to step through programs at a high level and look for a point where it stopped working. Then you go back to the last "Call" that succeeded and step into it, then repeat. Back then, the copy protection was usually writing to the disk and seeing if a subsequent read succeeded (If so, the copy protection failed because they used to burn part of the floppy with a laser so it couldn't be written to).
Then it was just a matter of finding the right call and hardcoding the correct return value from that call.
I'm sure it's still similar, but they go through a lot of effort to hide the location of the call. Last one I tried I gave up because it kept loading code over the code I was single-stepping through, and I'm sure it's gotten lots more complicated since then.
I wonder why they don't just distribute personalized binaries, where the name of the owner is stored somewhere (encrypted and obfuscated) in the binary or better distributed over the whole binary.. AFAIK Apple is doing this with the Music files from the iTunes store, however there it's far too easy, to remove the name from the files.
I assume each crack is different, but I would guess in most cases somebody spends
a lot of time in the debugger tracing the application in question.
The serial generator takes that one step further by analyzing the algorithm that
checks the serial number for validity and reverse engineers it.