When working in an interactive programming environment, such as one that only accepts text at a command prompt, (sometimes referred to as a Read-Eval-Print-Loop or REPL environment), users have to type in or paste text into the command line. Often, users want to perform an operation on data that is either too large or otherwise impossible to type in at the command prompt (e.g., an image). In this situation, a user instead types in a reference to the location of the data (for instance, a filename or web URL), with the file contents later loaded as data into the environment when appropriate.
However, when the data does not already reside in a file on disk, the data needs to be somehow saved to the file by the user, including naming the file. Then the filename needs to be remembered and accurately typed in at the command line.
For example, if the user wants to apply a function called “process_image” to an image that is open in a browser such as Internet Explorer, the user typically needs to right-click on or otherwise select the image and choose the “Save As . . . ” operation. The user then has to find a suitable location on the disk to save the image, and give it a filename. At the command prompt of the programming environment, the user then needs to type something like “img=load_image(“C:/Users/Me/MyDocuments/Data/MyImage.jpg”)” before calling the “process_image(img)” function. Unless the user wants to keep the file, the user also needs to remember to find the original image on disk and delete it when no longer needed.
This is quite cumbersome, and error prone, particularly if the filename has a long path.
This Summary is provided to introduce a selection of representative concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used in any way that would limit the scope of the claimed subject matter.
Briefly, various aspects of the subject matter described herein are directed towards a technology by which a user can, for example, cut-and-paste or drag-and-drop selected data, which may be non-textual data, into a data processing/programming environment. This includes a data processing/programming environment that includes a text-only command line. User-selected data is received (e.g., by a paste or drop operation) at a user interface of a program, such as a REPL or other data processing/programming environment. A data structure/data object comprising the selected data or transformed data corresponding to that selected data is maintained in program storage, e.g., RAM allocated to the program. An automatically generated variable name is used to reference the data structure, and the user interface is visually updated to indicate that some action has been taken with respect to the selected data, e.g., when received, the command line of the program may have the variable name inserted as text. The data in the data structure may then be further processed by accessing it via the variable name.
In one aspect, alternatives to receiving selected data from a paste or drop operation including receiving the data from a network communication and/or a data event from another source. For example, the data may be received from a network event from another computer, from a network event from a web service (e.g., a subscription as new data is available), or from an event from another process (e.g., a video capture process that communicates with the program), Other source examples include receiving an event from a web browser, (e.g., a user clicks a “Send to” button/link and the data appears in the data processing/programming environment with an assigned variable name), an event from other device on the computer, such as a flash drive, Bluetooth® device, data reader, and so forth that sends data to the data processing/programming environment, or an email/instant message to the data processing/programming environment.
In one aspect, a handler may be used to transform the data from one format into another that may be used by a particular program. For example, text may be reformatted into an array on which the program operates. The handler may be selected from a plurality of possible handlers, including customized handlers.
Other advantages may become apparent from the following detailed description when taken in conjunction with the drawings.
The present invention is illustrated by way of example and not limited in the accompanying figures in which like reference numerals indicate similar elements and in which:
Various aspects of the technology described herein are generally directed towards allowing a user to effectively insert copied data (e.g., from the system clipboard) into a programming or other data processing environment, including environments having a command prompt for data entry, via a straightforward paste or drag-and-drop operation. In one aspect, upon detecting the paste or drop command, a variable name is automatically generated and inserted at the current point in a command line, where it acts as a proxy for the pasted data itself. Also described are one or more handlers (possibly including extended handlers) that are able to transform the data into a format desired by the application corresponding to the programming/data processing environment.
It should be understood that any of the examples herein are non-limiting. Indeed, while a text-only command line is described because of the benefits and advantages provided by the technology in such an environment, any graphical or other programming/data processing environment may benefit from the technology described herein. As such, the present invention is not limited to any particular embodiments, aspects, concepts, structures, functionalities or examples described herein. Rather, any of the embodiments, aspects, concepts, structures, functionalities or examples described herein are non-limiting, and the present invention may be used in various ways that provide benefits and advantages in computing in general.
The programming/data processing environment 102 includes a user interface console 106, such as one that can only accept text. As described herein, the programming/data processing environment 102 further includes paste/drop detection and processing logic 108 (also described below with reference to
In addition to inserting (pasting or dropping) the data into the program storage 110, the paste/drop detection and processing logic 108 generates a variable name (e.g., “_var001” or anything not otherwise being used for other data in the current program environment) and has that variable point to the data that has just been pasted. That variable name is also inserted (e.g., as text) into the current point in the command line, where it acts as a proxy for the pasted data itself. Note that while
Note that
In sum, the technology allows using the well-known paste operation (or drag-and-drop) to enter the data into the programming/data processing environment 102. Instead of literally pasting the data in at the console that can only accept text, for example, the data itself is copied into the memory of the console process, and a proxy variable is created for it, which is pasted into the console buffer. The user can then operate on this proxy variable as if it were the data itself.
Moreover, it is possible that the contents of the system clipboard 102 containing the data to be pasted may not be in a format that is desirable or useable in the programming/data processing environment 102. As described herein, a data handler 112 allows for the data to be transformed into a format that is desired or useable. For example, if the user pastes a range of data from a spreadsheet, the data pasted is not in text format (which is what appears in the clipboard), but rather may be first transformed into a structured array datatype, e.g., comma separated values, an icon representing the text, and so forth.
By way of example of how automatic insertion and data handling may provide advantages, consider a user of an interactive programming environment who wants to sort a list of numbers copied from a spreadsheet. If the amount of data is small, it can be entered directly on the command line, e.g.:
However, if the amount of data is inconvenient, such as hundreds or thousands of numbers, the user may copy the data and then paste it into the programming environment which assigns the data to a variable, e.g., >>> sorted (_var002). Further, if the data was not in an appropriate format, a suitable data handler may be selected by the programming/data processing environment 102 to transform that data as desired, e.g., into comma separated values, rows and columns, or whatever is desired. When subsequent processing then operates on that variable, in essence treating the variable name as a proxy for the data itself, the large amount of numbers are sorted without typing in each number.
If a suitable handler is found as determined by step 306, step 308 represents that handler transforming the data to be pasted or dropped into the program storage 110 and storing the transformed data. For example, this may comprise calling a conversion function to create an appropriately formatted object in the program storage space.
Note that if not found, step 310 represents handling the data in some other way, such as copying it as plain text. If not possible to do so, e.g., the data is some image type that cannot be handled but is recognized as inappropriate to insert as text, other possible actions include informing the user that the data is not supported, informing the user that a particular handler needs to be downloaded and installed, and so forth.
Step 312 creates a new unused variable name (e.g., _var001) that refers to the newly-created object, and step 314 maintains an association between the variable and the object. Step 316 then inserts the variable name into the user interface console at the current cursor/pointer position.
As can be seen, one implementation inserts an object corresponding to the data itself into the program storage. The data may be transformed into a format more usable from the programming environment; arbitrary data types may be “pasted” into the application, including extending a program's capabilities by adding one or more new data handlers.
Other implementations are feasible. For example, rather than use program storage, the file system may be used for object storage, but without the user having any knowledge of where the data is stored. Thus as used herein, “program storage” need not necessarily be in RAM, but may be in any storage media, including all in part in remote storage media relative to the machine on which the program is running. Some or all of the referenced data may be fetched to local storage right away, on demand, lazily or continue to be accessed from remote storage.
Various ways to give the user an option to persist a data object into the file system are feasible, including via a graphical user interface. For example, text selection of the variable name followed by further user interaction may provide the user with an interactive way (e.g., a drop-down menu) to persist the data object corresponding to the selected variable name. As another example, the user may right click or otherwise select some data such as the image 224 of
Another alternative implementation does not necessarily require a command-line type environment. For example, consider the steps of
The invention is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to: personal computers, server computers, hand-held or laptop devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and so forth, which perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in local and/or remote computer storage media including memory storage devices.
With reference to
The computer 410 typically includes a variety of computer-readable media. Computer-readable media can be any available media that can be accessed by the computer 410 and includes both volatile and nonvolatile media, and removable and non-removable media. By way of example, and not limitation, computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by the computer 410. Communication media typically embodies computer-readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of the any of the above may also be included within the scope of computer-readable media.
The system memory 430 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 431 and random access memory (RAM) 432. A basic input/output system 433 (BIOS), containing the basic routines that help to transfer information between elements within computer 410, such as during start-up, is typically stored in ROM 431. RAM 432 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 420. By way of example, and not limitation,
The computer 410 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media, described above and illustrated in
The computer 410 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 480. The remote computer 480 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 410, although only a memory storage device 481 has been illustrated in
When used in a LAN networking environment, the computer 410 is connected to the LAN 471 through a network interface or adapter 470. When used in a WAN networking environment, the computer 410 typically includes a modem 472 or other means for establishing communications over the WAN 473, such as the Internet. The modem 472, which may be internal or external, may be connected to the system bus 421 via the user input interface 460 or other appropriate mechanism. A wireless networking component such as comprising an interface and antenna may be coupled through a suitable device such as an access point or peer computer to a WAN or LAN. In a networked environment, program modules depicted relative to the computer 410, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
An auxiliary subsystem 499 (e.g., for auxiliary display of content) may be connected via the user interface 460 to allow data such as program content, system status and event notifications to be provided to the user, even if the main portions of the computer system are in a low power state. The auxiliary subsystem 499 may be connected to the modem 472 and/or network interface 470 to allow communication between these systems while the main processing unit 420 is in a low power state.
While the invention is susceptible to various modifications and alternative constructions, certain illustrated embodiments thereof are shown in the drawings and have been described above in detail. It should be understood, however, that there is no intention to limit the invention to the specific forms disclosed, but on the contrary, the intention is to cover all modifications, alternative constructions, and equivalents falling within the spirit and scope of the invention.