Maxima (CAS): How to keep session history? - maxima

When starting a new session, Maxima forgets the history of the executed commands of the previous session. When I use up arrow, nothing shows up.
Can one force Maxima to keep the history of its sessions?
To be precise, I am taking about Maxima under Linux, but the question could be relevant for other OS's as well.

Related

Troubleshooting nightmare: non-replicatable errors while webscraping

I'm trying to run a webscraper that scrapes indeed.com and applies for jobs. What really gets me is the inconsistent, yet random errors. I'm not a programmer, but as far as I understand, if 2+2=4, then it should always be 4.
Here is the script I'm trying to run:
https://github.com/jmopr/job-hunter/blob/master/scraper.rb
Seems to only work with firefox v45.0.2 because of the geckodriver
My own fixes in scraper.rb if you wish to execute the script yourself:
config.allow_url("indeed.com")
JobScraper.new('https://www.indeed.com/', ARGV[0], ARGV[3]).scrape(ARGV[1], ARGV[2])
ERRORS
Example 1
def perform_search
# For indeed0
save_and_open_page
fill_in 'q', :with => #skillset
fill_in 'l', :with => #region
find('#fj').click
sleep(1)
end
Error: Unable to find class #fj. So it was able to find q, and l, but not fj. q and l are forms while fj is a button. How was it able to find the forms but not the button...????? Re-executed code via the terminal command rails server and the error went away. later came back again, how random in nature!!!! How is this possible? I can't even predict when it will happen so i can save_and_open_page
Example 2: error comes up when you run a search. no jobs get posted.
Error: block passed to #window_opened _by opened 0 windows instead of 1 (Capybara::Window Error)
Re-execute code, error went away, later comes back...
To clarify on example 2:
That error sometimes comes up since I have a Canadian IP address and it redirects me to indeed.ca. However, when used a US ip address via a VPN, that error was consistent 100% of the time. In an attempt to work around this, i've modified the code to go to the US version of the site, again, that error is consistent 100% of the time. Any idea on why this window is not popping up when i'm on the US version of indeed.com?
Summary:
i'm not necessarily looking for solutions, but an understanding of what is going on. Why the randomness in error.
2+2=4 under a given set of assumptions and conditions. Browsers and scrapers unfortunately aren't that predictable, with random delays, page throttling, changing pages, varying support levels for different technologies, etc.
In your current case the reason for the window_opened_by error could have been not having Capybara.default_max_wait_time set long enough (how long Capybara will wait for the window to open), however if you try the search manually you'll see that indeed no longer opens the job description in a new window if the current window is wide enough to show it in a right panel. Basically the code you're trying to use is no longer fully compatible with indeed.com due to changes in how indeed.com works. You could fix this by setting the drivers window size to a size where indeed.com will always open a new window, or by setting the window size big enough job descriptions open on the same page and rewriting the code to not look for a new window.
As for the no '#fj' issue, the easiest way to debug that is to put
save_and_open_screenshot if page.has_no_css?('#fj')
before the find('#fj').click and see what the page looks like when there is no '#fj' element on it. Doing that shows indeed.com is randomly returning the mobile site. Why this is happening I have no idea, but it could just be what indeed.com does when it doesn't recognize the current user agent. If that's the case you can probably work around that by setting the user agent the capybara-webkit driver uses, or you could just switch to calling click_button('Find Jobs') which should click the button on both the mobile and non-mobile pages.

How to stop MetaTrader Terminal 4 [MT4] offline chart from updating the prices

How do I stop MetaTrader Terminal 4 offline chart from updating the price on its own?
I want to update the price on my own because of the difference in timezone with my broker. I have checked all the properties and the MQL4 forum. No luck.
For truly offline-charts, there is a way
While regular charts process an independent event-flow, received from MT4-Server, there is a change for retaining your own control over TOHLCV-data records -- including the TimeZone shifts, synthetic Bar(s) additions and other adaptations, as needed.
You may create your own, transformed, TOHLCV-history and import these records via F2 facility, called in MT4 a History Centre.
How to avoid a live-quote-stream updates in MetaTrader Terminal 4
The simplest ever way is not to login to any Trading Server. This will avoid unwanted updates from reaching your local anFxQuoteStreamPROCESSOR.
There used to be a way, how to inject fake QuoteStreamDATA into a local MT4, however this enters a gray, if not black zone, as MetaQuotes, Inc., postulated the Server/Terminal protocol to be a protected IP and any attempt to reverse-engineer they consider an unlawfull violation of their rights and could cause legal consequences, so be carefull on stepping there. Anyway, a doable approach with an explicit risk warning being presented above.
Can't be done. Quotes get fed in from mt4 and get "evented" into the metatrader.

Action Replay for PC processes?

Back in my C64 and Amiga days, a company named Datel sold a cartridge called "Action Replay" that froze the running process (game) and let you modify its data. You could then either save the modified process to disk (permanently changing the game) or continue playing it.
Is there a way to do this with PC processes? I know how to pause a process and modify its memory, but am unsure how to save the process memory to disk as a new executable.
OllyDbg with the OllyDump plugin is a good combination to dump a process. It will correct the entry point address, import function addresses and anything else that needs to be fixed. It is a powerful combination but of course it lacks the ease of use of the Final Cartridge.

Delphi 5 application partially loaded in task manager, takes forever to actually display

I have an application written in Delphi 5, which runs fine on most (windows) computers.
However, occasionally the program begins to load (you can see it in task manager, uses about 2.5-3 MB of memory), but then stalls for a number of minutes, sometimes hours.
If you leave it long enough, the formshow event will eventually occur and the application window will pop up, but it seems like some other application or windows setting is preventing it from initially using all the memory it needs to run (approx. 35-40 MB).
Also, on some of my client's workstations, if they have MS Outlook running, they can close it and my application will pop up. Does anyone know what is going on here, and/or how to fix it?
Since nobody has given a better answer I'll take a stab at how to solve this:
There's something in your initialization that is locking it up somehow. Without seeing your code I do not know what it is so I'll only address how to go about finding it:
You need to log what you accomplish during startup. If you have any kind of screen showing I find the window title useful for this but it sounds like you don't--that means you need to write the log to a file. Let it get lost, kill the task and see where it got.
Note that this means you need to cleanly write your data despite an abnormal program termination. How to go about this:
A) Append, write your line, close.
B) Write your line, then flush the file handle.
C) Initially write your file to consist of a large number of blanks--ensure this is larger than the actual log will be. Write your line. In case of abnormal termination it will retain the original larger file size.
I would write a timestamp on every log item so you can see if it's just processing something too slowly.
If examining the log shows you where the problem is, fine. If, as usually happens, it's not enough you put a bunch more logging between the last item that did get logged and the next one that didn't--I've been known to log every line when hunting a cryptic problem that only happened on someone else's system.
If finding the line isn't enough to pinpoint the problem also dump the value of relevant variables.
Finally, if such intense scrutiny makes the bug go away start looking for an uninitialized variable. (While a memory stomp is also an option I doubt it's the culprit here.)

Is it possible to save and restore libtask coroutines?

I want to be able to suspend libtask coroutines to disk and then restore them again under a different process so they can continue where they left off.
This is not possible. Coroutine state is tied to the running process's execution state, open file descriptors, etc. It's actually a very difficult problem to solve in the general case, see this page on Wikipedia for a discussion:
http://en.wikipedia.org/wiki/Application_checkpointing
The approach you could take is to carefully define your coroutine's state and determine what information you'd need to store in order to reconstruct it. Then, you'd make the coroutine able to resume given that information.
Dragonfly BSD has the ability to suspend tasks and later resume them, but that's the only general solution I've heard of, save for VM image-based systems like Smalltalk and Squeak.

Resources