Command history in R - ide

Is there any IDE -from the ones supporting R-, that gives access to the command history (at least to the current session's commands)? Or is there a way to get a (character or expression) vector with those commands in R?
For those of you that have been using MATLAB, I mean something like the Command History window there..
Thank you

history(Inf)
opens a window similar to that in MATLAB.

savehistory('file')
myhistory <- scan('file','character')
Might do the trick.

I would highly recommend to use Emacs with ESS (Emacs speaks Statistic)

Eclipse with Stat-ET plugin will get you command history window and object browser.

The OS X GUI for R has a very nice command history mechanism built in. It works well with multi-line commands (e.g. long function definitions), and you can browse through the history in a pane on the side of the window.

The command history() will recall the last 25 used commands, whereas history(max.show=Inf)will get back all previous ones. If you are using RStudio on top of your R distro, CTRL + UP will give you the list of all previous commands.

Related

Trying to perform a diff using netbeans and its Git repository

I have two different version of a website, an older version, and a newer version that is supposed to have some sort of virus on it (or malicious code of some kind). I need to perform a diff between the two sites and try to eliminate the virus in the newer one.
After some searching I found netbeans 7.1 is able to do this using it's Git Repository. I was following this tutorial http://netbeans.org/kb/docs/ide/git.html but I am not getting the same options on my screen as in the tutorial. I am using netbeans 7.1 RC1 and downloaded the jdk from the link on that same page. The jdk download itself says jdk7 but the folder it creates on my computer is named jdk1.7.0_01 . I'm assuming jdk7 is short for jdk1.7 .
I get as far as the very end of the "Initializing a Git Repository" step. The end when it says "All the project files are marked Added in your Working Tree. To view a file status, place the cursor over the file name in the Projects window. The status of the file in the Working Tree displays in green to the right of the slash like shown in the following picture." does not happen.
I tried going further anyway, but there is just more and more options that do not show up for me.
I am also open to another way to perform a diff operation between the sites, it doesn't have to be with using netbeans. I should note however I do not have access to a unix box. So the solution has to work for windows, or I guess I can go on a coworkers mac if I need to.
Thank you.
From your question, it sounds like you did not already have your web site code under version control. If that's the case then I'd suggest doing so, and git is a very good choice. It is what I use.
Your goal, however, is to diff the older version of your site with the "newer" (possibly infected) version, and that can be done without having to deal with a version control system. There are several good diff tools for Windows. I mainly use WinMerge, as I like its user interface and simplicity. KDiff3 is another good one, and I use that one in conjunction with git merge operations, because it supports a three-way-merge comparison (which WinMerge does not).
If you were to use WinMerge for your diff, and you had the code from the old version in Q:\example.com\old-version and the "new" version in Q:\example.com\current-version, then you would start WinMerge, and either choose File|Open... from the menu, or click on the open icon in the toolbar. You would get a dialog like the following, and would fill it in as shown:
If you filled everything in correctly, then you would be able to click on the OK button, and would get a list of file differences. Depending on the default settings, you might also see files that have not changed at all in that list. You can hide those using the View menu. Double-clicking on a file with differences will open the two versions and show you the differences.
Explore the WinMerge options. I have mine set, for example, to compare white-space differences, but to ignore different line endings (Unix's LF versus Windows' CR/LF).

Gnu Emacs: tab-completion for psql running within sql.el process

I enjoy running Postgres client "psql" under psql.el while interacting with a .sql file in a separate window. Sometimes, I want to use tab-completion within the the buffer running the psql process to find the name of an appropriate table name. However, I can not figure out how to cause the desired result.
A very related question has been asked here: https://superuser.com/questions/236574/how-can-i-send-a-literal-tab-to-bash-in-emacs-shell-mode
without any successful suggestions.
Thanks in advance!
SetJmp
Usually programs that designed for interactive use (when they own terminal) disable interactive features (like history for UP/DOWN, completion for TAB) when used in pipe.
Emacs usually use pipes for external processes. So interactive features are disabled.
Even if you send TAB, your client program does not interpret it for you as you want.
You can read man/help for your program and try force interactive mode by providing command line switch (like --login for GNU Bash).
To send TAB eval:
(defun my-comint-send-string (string)
"Send string to comint buffers. Useful for *compilation* read-only buffer."
(interactive
(list (read-input "Type string: " nil 'my-comint-send-hist-list)))
(comint-send-string (get-buffer-process (current-buffer)) string))
(define-key XXX-mode-map [C-return] 'my-comint-send-string)
and use such key sequence: C-RET C-q TAB RET.
But this may not work if buffering is enabled for stdio of your program (to flush input you must send \n too)...
Mostly same problem discussed at Bash autocompletion in Emacs shell-mode
NOTE M-x term use pseudo terminal so all interactive program work as desired. But in this mode you lose any Emacs editing capabilities...

Script TFS Powertools shell extension getter

Is there a simple way to script the TFS powertools "get latest version" feature ?
I am refering to this window:
I just want to get it via a script, rather than by right clicking on a folder. I am aware of tf get but I like the powertools window better
The window you are showing above is not specific to TFS Powertools. That is the basic get window that comes packaged with TFS. Based on that fact, I am not 100% sure I understand your question.
Do you mean to say "How can I, using tfpt, do a get latest version and show this window." Maybe you are simply asking how to display the TFS window from the command line or via script?
TFPT has getcs if you know the latest changeset but that doesn't display in a window. TFPT adds features that TF doesn't have so obviously TFPT will not have a basic get.
I am unaware of a way, via a script (which would rely on tfpt or tf) to get latest in TFS and then display the aforementioned TFS get window. I can't think of any reason why there would be a need for this either. There is command line syntax to handle the gets.
Of course there are commands that will display in the viewer because it wouldn't make sense in plain text; however, since the get command simply gets files it wouldn't make sense to pop the viewer.

Mono Migration Analyzer: What are all of the command line switches?

So I'm looking here and I see the command line switches. http://mono-project.com/Command_Line_MoMA
This is what I see as the total amount of switches from the site:
MoMA.exe --nogui --out C:\app\momareport\report.html C:\app\myapp.exe
One thing I see is the submit.xml going to a place I don't want during my automated build. Since it is a generated file, I want to change where it goes. Is there a switch for that?
Also, what are all of the switches for it?
If there is not a switch for moving the submit.xml to a reporting location, please consider it for future versions.
EDIT: The argument --help does not work. I tried that and a host of others to try to get some dialog from MoMA on the command line. I'm on Windows to help alleviate any confusion.
Those are the only command line switches supported by MoMA. You can see the code here.
"MoMA.exe --help" does not work because MoMA is compiled as a winforms application so that the command window is not shown. As a result, MoMA disconnects from the command window, and therefore things like Console.WriteLine will not work.
To answer your actual question, there is currently not a way to change where the .xml file gets put.
You might want to try:
MoMA.exe --help
On Linux, there should also be a manpage.
If you can't find the feature, and want to submit it to Mono, you'll want to go via the Bugzilla page.

Hiding the console without losing std err/out streams

My question is similar to Running a CMD or BAT in silent mode, but with one additional constraint.
If you use WshScript.Run in vbscript, you lose access to the standard in/error/out streams of the process. WshScript.Exec gives you access to the standard streams, but you can't hide your windows. How can you have your cake (hide the windows) and eat it too (have direct access to the console streams)?
I'm currently thinking about a C++ executable which creates a new Windows Station and Desktop, (see MSDN) and runs a specified script within that new Desktop (I'm not yet an expert on Window Stations and Desktops, so this idea may be retarded).
This idea is based loosely on Condor's USE_VISIBLE_DESKTOP feature, which, if disabled, runs Condor jobs in a non-visible Desktop. I haven't quite figured out if this requires elevated priveledge.
The tradeoff of this approach is that your script can disappear into limbo if it blocks on user input.
Does anyone have any additional ideas? Or feedback on the approach outlined above?
Edit:
Also, the purpose of our script is to set up the user environment, so running as another user, or as a system scheduled task isn't really an option (unless there are clever tricks I don't know about).
I didn't have any luck with the VBScript fragment above - the windows would still pop up. However I did find a tool called hstart, which looks like about what I need. Unfortunately it isn't open source, or free for commercial use.
Cygwin (http://www.cygwin.com/) comes with a utility named run.exe which does what you are asking for a generic process. You could use this to wrap your call to cscript. Cygwin is GNU so free for commercial or personal use.
I only tested this a little bit, so YMMV...
Put the following code into a .vbs file (I called mine HideWindow.vbs):
Const HIDDEN_WINDOW = 12
computer = "."
Set oWmiService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
computer & "\root\cimv2")
Set oStartup = oWmiService.Get("Win32_ProcessStartup")
Set oConfig = oStartup.SpawnInstance_
oConfig.ShowWindow = HIDDEN_WINDOW
Set oProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
ret = oProcess.Create("cmd.exe /c C:\Scripts\test.cmd", null, oConfig, pid)
Call it from a batch file or command line like this:
CSCRIPT HideWindow.vbs
Whatever you put in test.cmd will run without displaying a window. This could be improved in several ways, but especially by parameterizing the program that gets called by oProcess.Create.
You could use Exec, a freeware tool I wrote that provides a command-line interface for the CreateProcess Windows API call. The GUI version doesn't have a console itself, and you can use it to start a shell script (batch file) in a hidden window.
Bill