How fast can a file be written/read by progress 4GL program? [closed] - openedge

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
I was given a task to build a program using progress 4gl to export a log file which should have all the details such as File name processed, completion time taken for read and write.
Is there anyway capture all these information? Please let me know and provide sample query to execute from my end. It helps a lot

A simple way is to use either TIME or ETIME depending on what kind of precision you need.
For precision in whole seconds:
DEFINE VARIABLE iStart AS INTEGER NO-UNDO.
DEFINE VARIABLE iEnd AS INTEGER NO-UNDO.
iStart = TIME.
/* Do something. Using pause to simulate. Use spacebar to break pause */
PAUSE 10.
iEnd = TIME.
MESSAGE "It took" iEnd - iStart "seconds".
For precision in milliseconds:
ETIME(TRUE).
/* Do something. Using pause to simulate. Use spacebar to break pause */
PAUSE 10.
MESSAGE "It took" ETIME "milliseconds".
You can also look at MTIME for a solution like the first but with milliseconds instead of seconds.

Related

Is there autosave for RStudio? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I've had instances where RStudio gets aborted and I lose my progress.
Is there autosave, at least for the R Scripts?
I think there might be something comparable on Windows. I am using RStudio on Mac.
Autosave for scripts exists. To enable autosave, go to “Preferences” › “Code” › “Saving” › “Auto-save”.
Regardless of the existence of autosave you should get in the habit of saving your script all the time. Case in point, when programming it’s not uncommon for me to save the current file several times per line typed. This takes up no time at all, thanks to shortcuts. It happens completely automatically.
Autosave for session data would kill reproducibility. It would be the ultimate anti-feature. Therefore not only does this feature not exist (per se), it’s actively undesirable.
To avoid losing your progress, write a script instead of executing code directly in the R shell. To save the results of expensive computations, decompose your logic into small blocks, and cache intermediate results.
RMarkdown allows you to do this out of the box; for other scripts, you can approximate the same using readRDS and loadRDS, or using a proper reproducibility framework such as Makefiles, or drake.
Yes, there is.
1) Autosaves are stored in %LOCALAPPDATA%\RStudio-Desktop.
2) [they are generated] Almost instantaneously (about every half second)
https://support.rstudio.com/hc/en-us/community/posts/208611187-Missing-Autosave

What happens when I enter .wq! in vim? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
What happens when I enter .wq! in vim?
Is there a way to prohibit that behavior?
use vim's help to understand each of those
. - repeat last change - :h .
w - move cursor to next word - :h w
q! - q would start recording a macro but since ! isn't a valid register to record the macro to they simply cancel each other
you could add nmap .wq! <Nop> to your vimrc to make this combination a noop but I wouldn't recommend doing that. It would make your . respond slower since it's a prefix for an existing map so if you ever learn more and start using this feature this mapping will annoy you.
But if you use :.wq! it will try to save the current line, overwriting the current file.

What flaws are exposed if encrypted version of plain message is always the same? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am working on a small encryption program which takes in a message, such as "Hello there!". Whenever I run the program with a message it produces the same encrypted result "Hu8z209=yTu83tu8". If I approached breaking the encryption using differential cryptanalysis, I could learn that there is no randomization in the algorithm. But what would this actually help me to learn in order to break the encryption?
The easiest thing is that it tells the MITM when your behavior changes.
Setup:
Every day you send a report at 0800 Encrypt("No enemy sighted"). The enemy notices this.
Scenario 1:
One day after they've started 'sneaking' toward you you send a different message. They know they were spotted and move into an all-out charge before your reinforcements arrive.
Scenario 2:
Imagine the enemy isn't invading and your message changes. They note this. Eventually they note the message changes every 8 days. If the message changes after only 6 days it means either a) you sent a different message or b) you changed your key/schedule. They'll possibly know which tomorrow.
So both of these scenarios told "the enemy" something. They could combine both to send an all-clear on your behalf right after they invade (the day after your keys change), giving them an 7 day head start on the next outpost. If the message ALWAYS changes, because of a random nonce/IV they get no information, and if the nonces are checked for duplicates by the receiver then they also prevent replayability.
But really this question belongs on http://crypto.stackexchange.com.

Run a loop while waiting for a click on the plot in R [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
in R there are several ways to wait for an input from the user, such as clicking somewhere on a graph (e.g. locator() function).
I'm looking for an option to record the user input WITHOUT waiting for it. I'm running a for loop with a locator() function in it, but this function prevents the for loop to progress unless the user click on something.
Any idea on how to overcome this?
Your best option is probably to use another GUI toolset, tcltk is one option. You can create a plot and display it in a Tk window, then set up a handler that will change a variable value if the user clicks on the plot, then you can have your loop doing other calculations and just check periodically if the variable set by the handler has changed.

asp.net function depends on the time [duplicate]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm developing a C# program that needs to be able to schedule a variety of asynchronous tasks at different times. I need a solution that activates every second to check for tasks to execute, and eats up as few resources as possible. It also needs to scale well to a large number of tasks. Which of these is better to use, or is there any ?
1) Using a System.Timers.Timer object with a 1 second elapsed time to trigger an event that executes tasks, or
2) Using a separate thread that sleeps for 1 second and then executes tasks when it wakes up, or
3) Something else entirely.
System.Threading.Timer is extremely lightweight. You could create a separate timer for each task so that the timer comes due when the task is supposed to execute.
Internally, I believe that the system will keep track of what timer is due next so it only has to monitor one timer at any given time (source/similar question).
Try looking at Quartz.Net for your scheduling needs. I think it's pretty good.

Resources