What are the efficient ways of keeping track of research literature?

You can stop apt-get temporarily with Ctrl-Z and then restart the job in the background with the bg command.

$ apt-get foo bar ...
^Z
bash: suspended apt-get
$ bg
bash: continued apt-get
$

However, when you do you'll continue getting the output from apt-get on the terminal. It isn't possible to stop that after you've already started the command (other than with dirty hacks using a debugger). You can run other commands here, though. While the job is stopped, it is still alive but not running, so it won't make any progress but you won't see any output either.

What you may find useful is the screen or tmux commands. They let you run multiple sessions with different terminals within the same physical terminal. If you're using X, you can run additional terminal emulators or perhaps create a new tab in your current one. Whichever way, you can run apt-get update in one shell and then switch to another to continue working.


You don't want either of those two options, though #2 is quite close. Option #1 is slow due to being row-by-row and each call being its own separate transaction. Even if you wrap all of the Stored Procedure calls into a single explicit Transaction, it will still be slower than a set-based approach.

Option #2 is flawed mainly for the additional work being done in both layers: joining the collection into a single string in the app layer, and splitting the string back out into elements in the data layer. However, the general structure of this idea — passing in just two params: ID and the collection of strings — is the way to go. You just need to use a Table-Valued Parameter (TVP) so that you can iterate through the collection as is, and receive it as a pre-populated Table Variable in SQL Server.

You do this by creating a User-Defined Table Type (which here could be a single NVARCHAR column) and using that as the parameter for the collection (hence the "Table"-Valued "Parameter").

The other piece to this puzzle is, on the app code side, creating a method that accepts int ID, List<String> _listobj and returns IEnumerable<SqlDataRecord>, and then use that method as the "Value" for the SqlParameter that is mapped to the TVP. Meaning, something like:

private static IEnumerable<SqlDataRecord> SendRows(List<String> RowData)
{
   SqlMetaData[] _TvpSchema = new SqlMetaData[] {
      new SqlMetaData("SomeSomething", SqlDbType.NVarChar, 4000)
   };
   SqlDataRecord _DataRecord = new SqlDataRecord(_TvpSchema);

   foreach (string _CurrentRow in RowData)
   {
      _DataRecord.SetString(0, _CurrentRow);

      yield return _DataRecord;
   }
}

Then, you would just pass in SendRows(_listobj) as the value for the TVP parameter. When you execute the SqlCommand, it will call that method and stream that collection into SQL Server.

The technique shown above requires no additional memory or processing, it just sends the collection as a collection. No need for DataTables or String.Joining or splitting :-).

To see a complete example code setup for this, please see my answer to the following Stack Overflow question: Pass Dictionary to Stored Procedure T-SQL.


If anyone is looking for another possible solution for Debian (possibly not Ubuntu):

In /etc/kbd/config, look for a setting called "BLANK_TIME":

# screen blanking timeout.  monitor remains on, but the screen is cleared to
# range: 0-60 min (0==never)  kernels I've looked at default to 10 minutes.
# (see linux/drivers/char/console.c)
BLANK_TIME=30

Change it to 0, this will disable it:

BLANK_TIME=0

Tested on Debian 6 and 7.