Skip to main content

MSSQL Active Users

Sometimes you want to be able to list the active users, and you can use the system stored procedures of sp_who and sp_who2 to do that. However, I've found that it's inconvenient for a couple of reasons.

  1. If you run it from a command line, it scrolls over the 80 column limit you usually have in a terminal session (sometimes I run this using a command like osql -E -S sql -Q 'exec master..usp_ListUsers'). While this also goes over the 80 column limit, it goes over 2 lines, so it's more readable to me.
  2. This allows you to enter either a database name or a user name and filter the output so you only see those results. In this way, I can see the users who are currently connected to master, msdb, or some other user database inside SQL Server. I just feel this gives me more flexibility in looking at what's going on with the server.
PRINT 'Building usp_ListUsers - Starting'
GO

IF NOT ( object_id ( 'usp_ListUsers' ) is NULL )
BEGIN
   DROP PROCEDURE usp_ListUsers
END
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
SETUSER  'dbo'
GO

CREATE PROCEDURE usp_ListUsers
   @astr_database VARCHAR (50) = NULL,
   @astr_user VARCHAR (50) = NULL
AS
BEGIN

/*********************************************************************
NAME:  usp_ListUsers

DATABASE:
   master

PARAMETERS:
   astr_Database - (Optional) The database to report on (list users in)
   astr_User - (Optional) The user to find and report on

ASSUMPTIONS:
   NONE

COMMENTS:
   NONE

AUTHOR(S):
   TJB - Timothy J. Bruce

PURPOSE:

MODIFICATION HISTORY

Init  Date      Comments
TJB   07Mar02   Initially Created

*********************************************************************/

/* Declare Variables */

   DECLARE @lstr_Database CHAR ( 20 )
   DECLARE @lstr_Error1 CHAR ( 50 )
   DECLARE @lstr_Error2 CHAR ( 50 )
   DECLARE @lstr_user VARCHAR ( 50 )

   DECLARE @llng_Count INTEGER
   DECLARE @llng_DBID INTEGER

/* Set up the Environment */

   SET NOCOUNT ON

/* Begin Processing */

   IF @astr_database IS NOT NULL
   BEGIN
       IF db_id ( @astr_database ) IS NULL
       BEGIN
       -- If there is no associated db_id, it doesn't exist.
            SELECT @lstr_Error1 = 'The database name you entered ('
            SELECT @lstr_Error2 = ') is not valid for this server.'
            SELECT 'Error'=@lstr_Error1 + @astr_database + @lstr_Error2
            RETURN ( -1 )
       END
       ELSE
       BEGIN
       -- Found the database - lets list all the users in it.
           --SET 'DB' = @astr_database
           SELECT
               spid,
               'Status' = CONVERT ( CHAR(10), status ),
               'login' = CONVERT ( CHAR (15), loginame),
               'NT Account' = CONVERT ( CHAR (12), nt_username),
               'Workstation Id' = CONVERT ( CHAR (15), hostname),
               blk = CONVERT ( CHAR (5), blocked),
               dbname = CONVERT ( CHAR (20), db_name(dbid) ),
               'Program' = CONVERT ( CHAR (10), program_name),
               'Command' = CONVERT ( CHAR (20), cmd )
           FROM
               master.dbo.sysprocesses
           WHERE
               spid BETWEEN 0 and 32767 AND
               dbid = db_id ( @astr_database )
           ORDER BY
               loginame,
               hostname,
               spid
       END
   END
   ELSE
   BEGIN
       IF @astr_user IS NOT NULL
       BEGIN
           SELECT @lstr_user = '%'+ @astr_User + '%'
           SELECT @llng_Count = COUNT(*) FROM master..sysprocesses WHERE UPPER ( nt_username ) LIKE UPPER ( @lstr_user )
           IF @llng_Count  = 0
           BEGIN
               SELECT 'Error' = 'User ''' + @astr_User + ''' could not be found.'
               RETURN ( -2 )
           END
           ELSE
           BEGIN
               SELECT
                   spid,
                   'Status' = CONVERT ( CHAR(10), status ),
                   'login' = CONVERT ( CHAR (15), loginame),
                   'NT Account' = CONVERT ( CHAR (12), nt_username),
                   'Workstation Id' = CONVERT ( CHAR (15), hostname),
                   blk = CONVERT ( CHAR (5), blocked),
                   dbname = CONVERT ( CHAR (20), db_name(dbid) ),
                   'Program' = CONVERT ( CHAR (10), program_name),
                   'Command' = CONVERT ( CHAR (20), cmd )
               FROM
                   master.dbo.sysprocesses
               WHERE
                   spid BETWEEN 0 and 32767 AND
                   UPPER ( nt_username ) LIKE UPPER ( @lstr_user )
               ORDER BY
                   loginame,
                   hostname,
                   spid
           END
       END
       ELSE
       BEGIN
           /* All Users & Processes */
           SELECT
               spid,
               'Status' = CONVERT ( CHAR(10), status ),
               'login' = CONVERT ( CHAR (15), loginame),
               'NT Account' = CONVERT ( CHAR (12), nt_username),
               'Workstation Id' = CONVERT ( CHAR (15), hostname),
               blk = CONVERT ( CHAR (5), blocked),
               dbname = CONVERT ( CHAR (20), db_name(dbid) ),
               'Program' = CONVERT ( CHAR (10), program_name),
               'Command' = CONVERT ( CHAR (20), cmd )
           from
               master.dbo.sysprocesses
           where
               spid BETWEEN 0 and 32767
           ORDER BY
               loginame,
               hostname,
               spid
       END
   END
   RETURN ( 0 )
END

GRANT EXECUTE ON usp_ListUsers TO PUBLIC

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SETUSER
go

PRINT 'Building usp_ListUsers - Finished'
GO

If you have any questions, feel free to contact me.

Database General Information

What is a database? A database is a container of related data, usually identified by data stored in tabular, row-column format. This differs from a datastore in that a datastore usually refers to a single object. A datastore could be a PDF (Adobe Acrobat format) document, a word processing document, a picture, or some other format or document.

The most common format for databases is now SQL or Structured Query Language. This is an international standard, although there is no formal certification process to determine compliance with the published standard.

SQL is really a set of three languages for databases rolled up into one. It is split into three parts: Data Manipulation Language (DML), Data Definition Language (DDL) and Data Security Language (DSL). Primarily when people talk about SQL they are referring to DML, since once the database is set up the only thing that is performed is the manipulation of the data in the database.

So you as a reader go, "So What?" I'm not really into computers, and I don't want to really learn something as 'geeky' as databases. Besides, I don't use one and have no intention of using one." While that is true, your data is stored in a database of some kind. You r state government stores Drivers License information in a database. Your bank uses many databases to keep track of the balances on your credit cards and other bank accounts. Companies you deal with use databases to track money owed by clients. The Federal Government uses hundreds of databases to track taxes, benefits, and a myriad of other pieces of data to make governing easier. So databases exist all around you, even if you don't use one yourself.

So what is a database? I've seen many definitions over the years. But one of the best I've seen described it as a container that stores data in a regular format, usually graphically depicted as rows of related data in columns that hold the same type of information.

One of the common ways to manipulate data or manage databases is through stored procedures. These are bits of SQL that are pre-compiled (NOTE: While SQL is not normally compiled into machine language, this "compilation" is used to optimize the SQL so it is more efficient and doesn't have to be evaluated when it is executed, speeding up execution.) for more efficient use.

Linux Info

There is a lot of discussion about an alternative opeerating system to Microsoft Windows called Linux. There is a lot of confusion about why it would be free, is it good, and does it really work.

To be complete, Linux is a combination of something called the kernel (or main set of instructions that control the Central Processing Unit (CPU) and how it interfaces with other computer hardware), the particular Graphical User Interface (GUI) (since there are many, each providing different features) and a set of applications. Each distribution is put together by a person or team and supported in different manners. The kernel was developed by a young finnish student named Linus Torvalds as part of his post-baccalauratte work. The utilities used to help manage the system are mostly GNU. For more information about GNU (GNU's Not Unix) can be found at www.gnu.org.

But if you are really looking for more information about managing (and using) a linux system, the following documentation might help you learn more.

NAG Network Administrator's Guide http://www.tldp.org
SAG System Administrator's Guide http://www.tldp.org
LAME Linux Administration Made Easy http://www.tldp.org
RUTE RUTE http://rute.sourceforge.net

All linux distributions can be managed from the command line (interface or CLI), although some may provide tools to manage all or part of the system through the GUI. Some commands that may of critical interest to you as a Linux user at the command line (terminal) include:

Linux Command Description
info "info" documentation about your linux system. Some commands have a significant amount of information written about the in a format for new users to understand.
man The online manual for many commands. These assume the user already understands the purpose (even though a short purpose is provided). It is more of a syntax reference and is written for experienced users use the command effectively.
apropos This is a command that allows the user to search for a particular command that has a keyword in it's name or short description. This is usually a helpful guide giving the user a place to search for more information.

Try the command apropos zip in your terminal to see several commands that are related to zip file compression.

NOTE: There are several other commands that show up because the word "zip" shows up in the description or name of the command, even if it isn't exactly what you are looking for.

Additional commands can be found from the guides listed above and by exploring The Linux Documentation Project web site (http://www.tldp.org).

Windows Utilities

I'm frequently asked about "utilities" to help solve some computer problem. I've always defined a utility as some small (hmmm...another relative term) piece of software to help accomplish a task. Usually the size is on the order of less than a floppy (the old 5 1/4" 360K floppy disks) but with changes in software and the use of graphical components, I've considered it a little larger. I guess I would have to describe them as something outside the normal realm of major busuiness class software (even though anti-virus and Spyware removal apply here as well!).

Anyway, here is a list of some of the utilities that I use when I work on other people's computers. Of course, all of these are FREE except for the cost of downloading them. Please review the most current version of the license in case it has changed.

  • 7 Zip (Archiver for .ZIP, .GZ, and LOTS of others) - Download
  • Ad Aware (Spyware removal) - Download
  • AVG (Now GriSoft) Anti-Virus (Free for Non-commercial use) - Download
  • Context (Text Editor) - Download
  • Cygwin (Unix Environment under DOS/Windows) - Download
  • MeSoft Commander (File Management Utility) - Download
  • Mozilla Suite (Web Browser / Web Page Editor) - Download
  • Mozilla Seamonkey Suite - Download
  • Mozilla Firefox (Web Browser) - Download
  • Mozilla Thunderbird (e-Mail Software - replaces Outlook) - Download
  • Ptty (Terminal Program) - Download
  • VNC (Windowing Remote Desktop) - Download

NOTE: Clicking on any of these links leaves my site. I am NOT responsible for the content or availabilty of these links.

Updated 29 April 2010 with current links. Removed Mozilla Suite and replaced with Seamonkey Suite.

Job Descriptions

NOTE: This should be reformatted, probably like a list of terms(?).

On some occasions, I've been asked what some job descriptions are for computer (IT or Information Technology) personnel. I've started to compile this list based upon my own experiences and other people I've asked (who've helped me refine my list). Feel free to browse around in case you are looking for information about specific types of jobs in the IT career field, which is extremely varied.

Client/Server Programmer/Analyst Monitors applications performance and perform run-time improvement functions. Accomplished in coding, testing, and creating computer programs and sub-systems. Skill in using multiple programming languages in developing and maintaining projects within a client's client/server architecture. Interacts with customers to define system requirements and priorities. Server knowledge: UNIX, Windows NT, operating systems. Proficient in one or more database management systems, such as ORACLE, SYBASE, INFORMIX, or SQL server. Client knowledge: must have ability to develop front-end applications, and experience with development tools such as Delphi, UNIFACE, and INFORMIX. Expertise with GUI development, Visual Basic, and Visual C++.

Database Administrator Administers and controls an organization's data resources. Uses data dictionary software packages to ensure data integrity and security, to recover corrupted data, and to eliminate data redundancy, and tuning tools to improve database performance. Must have expertise in several DBMS systems and knowledge of various DBMS products.

Database Analyst Uses data modeling techniques to analyze and specify data usage within an application area. Defines both logical views and physical data structures. Internet/Intranet Developer Extensive experience in Web site development tools and vendor relations. Knowledge of Netscape and Internet Explorer. Builds software and user-interface applications to provide the technical architecture of Web sites or Web-based software products. Uses various programming and scripting languages like HTML, Java, PERL, Visual Basic, Visual C++. Well versed in the dominant Internet applications, such as e-mail, World Wide Web, Wide-Area Information Server (WAIS), Gopher, Mosaic, and Firewalls.

Mainframe Programmer Codes and maintains business application programs>from user instructions or formal functional specifications. Develops and supports large-scale batch or high-volume transaction environments that require mainframe-processing power. Programs in business-oriented languages such as COBOL, PL/1 or 4GLs.

Microcomputer Programmer Develops and supports small-scale user interface, GUI interface, and database-oriented applications. Programs in business-oriented languages such as COBOL, 4GLs such as SQL, PAL, Powerbuilder, Visual Basic and Xbase, or systems-oriented languages such as C or Pascal.

Midrange Programmer Develops and supports enterprise-oriented applications for large companies, or general business applications for medium companies. Programs in business-oriented languages such as COBOL and RPG/400, system-oriented languages such as C and Pascal, and object-oriented languages such as C++ and Smalltalk or 4GLs. PC Applications Specialist Responsible for overall coordination, control, and maintenance of personal computers within the enterprise, to ensure compatibility and integration with enterprise strategies. Assists in installing, modifying, and supporting 4th-generation language environments. Other areas of responsibility include supporting the personal computer and office automation environments, to maintain environmental continuity.

Project Manager/Lead Plans and oversees the development and support of a specific application or functional area. Coordinates resources, schedules and communications for application development projects. Develops project schedules and assigns tasks. Performs both systems analysis and programming. Serves as contact with user groups and systems management.

Software Engineer Designs and develops systems-level software such as operating systems, network management, database management software, languages, and GUIs. Also designs and develops general applications software such as spreadsheets, word processors, graphics packages, and communications packages. Programs in system and object-oriented languages such C, C++, Assembly, Smalltalk, or PL/1.

Software Tester/Quality Assurance Evaluates and tests software to verify that programs function according to specifications, documentation, and standards. Creates and executes automated test scripts using testing software. Identify, analyze, and document defects, questionable functions, errors, and inconsistencies in software program functions, outputs, online screens, and content. Create test cases, test data, and establish benchmarks for program efficiency in operating and response times. Review and contribute to software program documentation.

Systems Administrator Installs minicomputer operating systems software, database management systems software, compilers and utilities. Monitors and tunes systems software, peripherals, and networks. Installs new users, creates batch administration scripts, and runs systems backups. Resolves systems problems.

Systems Analyst Works directly with management and users to analyze, specify, and design business applications. Develops detailed functional specifications, system specs, and program specs using structured design methodologies and CASE tools. Systems Integrator Architect Combines knowledge of multiple platforms, applications development, LANs and packaged software to create quick, low-cost solutions to specific business requirements. Assists the organization in establishing operational procedures, redefining workflow and overseeing application implementation. Systems Programmer Installs and maintains mainframe operating systems, communication software, database management software, compilers and utility programs. Provides technical support to applications programmers, hardware/software evaluation and planning. Creates and modifies special-purpose utility programs. Ensures systems efficiency and integrity.

Telecommunications Analyst Evaluates, selects, installs and maintains data and voice communications software, hardware and network. Evaluates tariffs. Serves as liaison to common carriers and vendors.

Modem Commands

Rarely, do you need a list of Modem commands. (For that matter, how do you even send these when troubleshooting a modem? Oh, wait - that's another document I need to produce. How to use the tools that come with Microsoft Windows or Linux to actually send the commands.)

At any rate, if you find the need to actually send commands when troubleshooting a modem, here is a list of some of them.

AT Commands

+++   Keep data connection and move from data mode to command mode.
A   Answer command
A/   Reexecute last command
Bn   Protocol for 1200bps operation
  0 ITU-T V.22 mode when modem is operating at 1200bps.
  1 Bell 212A mode when modem is operating at 1200bps. (default)
  2 Unselects V.23 reverse channel (same as B3)
  3 unselects V.23 reverse channel (same as B2)
  15 Selects V.21 when the modem is at 300 bits/sec.
  16 Selects Bell 103J when the modem is at 300 bits/sec (default)
D   Dial Command
  T Tone Dial
  P Pulse Dial
  L Redials the last number
  R Originate the call using the answer tone.
  S=n Dial a stored number (n is the storage location)
  W Wait for second dial tone
  V The modem switches to speakerphone mode and dials the number
  ^ Disable data calling tone transmission
  , Pause during dialing (set in register S8 - usually .5 sec)
  @ Wait for quiet answer. Wait for 5 seconds of silence after dialing a number. If silence is not detected, modem sends a NO ANSWER result code to the user.
  ! Hookflash for 0.5 seconds
  ; Causes modem to return to command mode after dialing number
En   Echo characters in command mode
  0 Do not echo commands
  1 Echo commands (default)
Hn   Hook switch
  0 Go on-hook (hang up modem)
  1 Go off-hook
Ln   Speaker Volume
  0 Very Low
  1 Low
  2 Medium (Default)
  3 High
Mn   Speaker Status
  0 Speaker always off
  1 Speaker on until carrier is detected (default)
  2 Speaker always on
Nn   DCE data rate
  0 When originating or answering call, handshake only at the communication standard specified by S37, and the ATB command
  1 When originating or answering call, handshake only at the communication standard specified by S37, and the ATB command. During handshake, modem may fall back to a lower speed (default)
On   RETURN to data mode after using escape characters to switch to command mode
  0 Return to data mode
  1 Perform equalizer retrain sequence, then return to data mode
  3 Perform a rate re-negotiating, then return to data mode
Qn   Modem Responses
  0 Send responses to local computer (default)
  1 Do not send response
Sn?   Display value stored in register "n"
Sn=v   Set register "n" to value "v".
Vn   Response format
  0 Numeric response format
  1 Word response format (default)
Xn   Response set
  0 Modem ignores dial tone and busy signal; enables response 0-4
  1 Modem ignores dial tone and busy signal; enables extended result codes.
  2 Modem ignores busy signal; enables dial tone and extended result codes
  3 Modem ignores dial tone and busy signal; enables extended result codes
  4 Modem recognizes dial tone, busy signal and extended result codes. (default)
  5 Modem recognizes dial tone, busy signal and extended result codes
  6 Modem recognizes dial tone, busy signal and extended result codes
  7 Modem recognizes dial tone and busy signal and ignores extended result codes
Zn   Recall Stored Profiles This command instructs the modem chip set to go on-hook and restore the profile saved by the last &@ command. Either Z0 or Z1 restores the same single profile.
  0 Reset and retrieve configuration from profile 0
  1 Reset and retrieve configuration from profile 1
&Cn   Carrier Detect signal status (DCD Signal) Controls the Data Carrier Detect (DCD) signal
  0 Forced on continuously
  1 Follows status of remote carrier signal (default)
&Dn   Data Terminal Ready signal status (DTR signal) Determine how your modem reacts to Data Terminal Ready (DTR) signal
  0 Ignore. The modem ignores the true status of DTR signal and treats it as always on. This should only be used if your computer does not provide DTR to the mode. (default)
  1 If the DTR signal is not detected while in on-line data mode, the modem enters command mode, issues OK result code, and remains connected.
  2 If the DTR signal is not detected while in on-line data mode, the modem disconnects.
  3 Modem resets when DTR goes off.
&F   Recall factory default
  0 Recall factory setting as active configuration
&Gn   Guard tones (not used in the USA)
  0 Disabled (default)
  1 Generate 550 Hz guard tone
  2 Generate 1800 Hz guard tone
&Kn   Flow Control
  0 Disable flow control; same as Q0 command
  1 Reserved
  2 Reserved
  3 Enable hardware flow control (RTS/CTS); same as Q3 (default)
  4 Enable software flow control (XON/XOFF); same as Q1
  5 Reserved
&Qn   Asynchronous communication mode
  0 Asynchronous mode, buffered. Same as N0
  5 Error control mode, buffered. (default) Same as N3
  6 Asynchronous mode, buffered. Same as N0
&Sn   Data Set Ready signal status
  0 DSR signal always ON (default)
  1 DSR signal is ON during handshaking and OFF in test or idle mode. DSR is OFF when the remote carrier signal is lost.
&Tn   Self-test Commands Initiates modem tests. If you want to include this command with other commands, this command must be the last command in the command line.
  0 Terminate Test
  1 Local analog loopback
  3 Local activated remote digital loopback (RDL)
  6 Remote
&Vn   View any stored configuration profiles
  0 View stored profile 0
&Wn   Store current configuration. The following commands and registers can be stored in nonvolatile memory. Commands: Bn, En, Ln, Mn, Qn, T/P, Vn, Xn, &Cn, &Dn, &Gn… Registers: S0, S2, S6, S7, S8, S10, S11, S12, S37
  0 Write S register values to profile 0.
&Yn   Select stored profile on power-up reset This command does not change the behavior of the modem, but is included for compatibility with applications that issue the &Y0 command
  0 Select stored profile 0 on powerup
  1 ERROR (There is one stored profile available with most modems - Profile 0)
&Zn=x   Stores telephone numbers (could be up to 4) in nonvolatile memory.
  n The memory location (0 - 3)
  x The telephone number to be stored To dial a stored number, use the ATDS = n command. Example: AT&Z0=1 555 1212 stores telephone number 1-555-1212 in memory position 0.

MNP/V.42 and MNP/V.42bis Commands

%Cn   Enable/disable V.42bis / MNP Class 5 data compression
  0 Disable data compression
  1 Enable data compression (default)
Nn   Set operating mode
    Selects the type of asynchronous data connections the modem will try to establish. A modem that uses V.42 cannot communicate with one using MNP, since the two error correction protocols are different. However, this command ensures that your modem can automatically communicate with modems that use V.42bis, MNP, or no error correction protocol.
  0 Normal mode. No protocol., but flow control is allowed.
  1 Direct mode. No protocol and no flow control is allowed.
  2 MNP reliable mode or disconnect.
  3 V.42/MNP auto-reliable mode (default)
  4 V.42 LAP or MNP reliable mode.
  5 V.42 LAPM mode (same as N3)
  7 V.42 LAPM mode (same as N3)
Qn   Set serial port flow
    Determine how the modem informs your computer to stop sending data so that the modem buffer will not overflow with data.
  0 Disable flow control
  1 Bi-directional software (XON/XOFF) flow control. The modem and computer exchange ASCII characters to start and stop data transmission between them.
  3 Bi-directional hardware (CTS/RTS) flow control. When your modem receives the Request to Send (RTS) signal from the computer, indicating that the computer wants to send data, the modem responds by sending the CTS signal. Similarly, the modem sends CTS to the computer and expects to receive RTS from the computer. (default)
T0   Inactivity timer disabled.
Vn   Protocol result code
  0 Disable protocol result code append to DCE speed.
  1 enable protocol result code append to DCE speed (default)
-Cn   Set calling tone in Data Mode
  0 Disable calling tone (default)
  1 Enable calling tone

S-Registers

Register Range Value Default Definition
S0 0-255 Rings 0 Number of rings to auto-answer
S1 0-255 Rings 0 Holds the number of incoming rings (count)
S2 0-255 ASCII 43 Escape character (^[)
S3 0-127 ASCII 13 Carriage Return character (^M)
S4 0-127 ASCII 10 Line Feed character (^J)
S5 0-255 ASCII 8 Backspace character (^H)
S6 2-255 Seconds 2 Dial tone wait time before blind dialing
S7 1-255 Seconds 50 Remote carrier wait time
S8 0-255 Seconds 2 Comma pause time
S9 1-255 100 ms 6 Carrier detect response time
S10 1-255 100 ms 14 Delay between carrier loss and hang-up
S11 50-255 1 ms 95 Tone duration in DTMF dialing
S12 0-255 20 ms 50 Escape code guard time
S13       Reserved
S14       Bit Mapped Options
S15       Reserved
S16       Test mode bit mapped options
S17       Reserved
S18 0-255 Seconds 0 Modem test timer
S19       Reserved
S20       Reserved
S21       V.24 bit mapped options
S22       Speaker bit mapped options
S23       Bit mapped options
S24 0-255 Seconds 0 Sleep inactivity timer
S25 0-255 10 ms 5 Data Terminal Ready (DTR) delay
S26 0-255 10 ms 1 RTS to CTS delay
S27       Bit mapped options
S28       Bit mapped options
S29 0-255 10 ms 0 (disable) Flash dial modifier time
S30 0-255 10 Sec 0 (disable) Inactivity time before hang up
S31       Bit mapped options
S32 0-255 ASCII 17 XON Character
S33 0-255 ASCII 19 XOFF Character
S34       Reserved
S35       Reserved
S36   7   LAPM failure control
  0     Modem disconnects
  3     Modem stays on line and establishes a normal mode (speed buffering) connection.
  4     Attempts MNP connection. If fails, it disconnects.
  7     Attempts MNP connection. If fails, it establishes a normal mode (speed buffering) connection.
S37 0-12 0   Desired DTE connection speed
  0     Attempt automode connection (F0)
  1-3     300 BPS (F1)
  4     Reserved
  5     1200 BPS (F4)
  6     2400 BPS (F5)
  7     75 BPS send / 1200 BPS receive V.23 (F3)
  8     4800 BPS (F6)
  9     9600 BPS (F8)
  10     12000 BPS (F9)
  11     14000 BPS (F10)
  12     7200 BPS (F7)
S38 0-255 Seconds 20 Delay before forced disconnect
S39 0-6   3 Flow Control
  0     No flow control
  3     RTS / CTS (&K3)
  4     XON / XOFF
  5     Transparent XON (&K5)
  6     Both methods (&K6)
S40       Bit mapped options
S41       Bit mapped options
S42       Reserved
S43       Reserved
S44       Reserved
S45       Reserved
S46 136 / 138 138   Data compression selection
  136     Error correction with no compression
  138     Error correction and compression

Modem Result Codes

This is the result codes that can come back from the modem:

Short Form     Long Form
n              Value in AT Xn Command        0      1      2      3      4
0              OK                            X      X      X      X      X
1              CONNECT                       X      X      X      X      X
2              RING                          X      X      X      X      X
3              NO CARRIER                    X      X      X      X      X
4              ERROR                         X      X      X      X      X
5              CONNECT 1200                  X1     X      X      X      X
6              NO DIALTONE                   X1     X1     X      X      X
7              BUSY                          X1     X1     X1     X      X
8              NO ANSWER                     X      X      X      X      X
9              CONNECT 0600                  X1     X      X      X      X
10             CONNECT 2400                  X1     X      X      X      X
11             CONNECT 4800                  X1     X      X      X      X
12             CONNECT 9600                  X1     X      X      X      X
13             CONNECT 7200                  X1     X      X      X      X
14             CONNECT 12000                 X1     X      X      X      X
15             CONNECT 14400                 X1     X      X      X      X
16             CONNECT 19200                 X1     X      X      X      X
17             CONNECT 38400                 X1     X      X      X      X
18             CONNECT 57600                 X1     X      X      X      X
22             CONNECT 1200 TX / 75 RX       X1     X      X      X      X
23             CONNECT 75 TX / 1200 RX       X1     X      X      X      X
40             CARRIER 300                                 X
44             CARRIER 1200 / 75                                  X
45             CARRIER 75 / 1200                                  X
46             CARRIER 1200                                X
47             CARRIER 2400                                X
48             CARRIER 4800                                X
49             CARRIER 7200                                X
50             CARRIER 9600                                X
51             CARRIER 12000                               X
52             CARRIER 14400                               X
69             COMPRESSION: NONE                                  X
76             PROTOCOL: NONE                              X
33             FAX                           X      X      X      X      X
34            +FCERROR                       X      X      X      X      X
35             DATA                          X      X      X      X      X

Color Names

Occasionally I've need a list of the web "safe" colors. But instead of a simple list, I wanted to display the actual color so I might have an idea of what it looks like. This is not expected to be the "real" color, as people who do color matching and typesetting know that your monitor and graphics card(?) have to be setup for the "real" colors to match professional printing. However, this will represent the colors and show relationships for the kind of work I do (i.e., It's good enough).

The 140 web color names are displayed alphabetically in the table below along with their respective RGB values (in both decimal and hexadecimal).

aliceblue 240,248,255 F0F8FF

darkslategray 47,79,79 2F4F4F

lightsalmon 255,160,122 FFA07A

palevioletred 219,112,147 DB7093

antiquewhite 250,235,215 FAEBD7

darkturquoise 0,206,209 00CED1

lightseagreen 32,178,170 20B2AA

papayawhip 255,239,213 FFEFD5

aqua 0,255,255 00FFFF

darkviolet 148,0,211 9400D3

lightskyblue 135,206,250 87CEFA

peachpuff 255,239,213 FFDAB9

aquamarine 127,255,212 7FFFD4

deeppink 255,20,147 FF1493

lightslategray 119,136,153 778899

peru 205,133,63 CD853F

azure 240,255,255 F0FFFF

deepskyblue 0,191,255 00BFFF

lightsteelblue 176,196,222 B0C4DE

pink 255,192,203 FFC0CB

beige 245,245,220 F5F5DC

dimgray 105,105,105 696969

lightyellow 255,255,224 FFFFE0

plum 221,160,221 DDA0DD

bisque 255,228,196 FFE4C4

dodgerblue 30,144,255 1E90FF

lime 0,255,0 00FF00

powderblue 176,224,230 B0E0E6

black 0,0,0 000000

firebrick 178,34,34 B22222

limegreen 50,205,50 32CD32

purple 128,0,128 800080

blanchedalmond 255,255,205 FFEBCD

floralwhite 255,250,240 FFFAF0

linen 250,240,230 FAF0E6

red 255,0,0 FF0000

blue 0,0,255 0000FF

forestgreen 34,139,34 228B22

magenta 255,0,255 FF00FF

rosybrown 188,143,143 BC8F8F

blueviolet 138,43,226 8A2BE2

fuchsia 255,0,255 FF00FF

maroon 128,0,0 800000

royalblue 65,105,225 4169E1

brown 165,42,42 A52A2A

gainsboro 220,220,220 DCDCDC

mediumaquamarine 102,205,170 66CDAA

saddlebrown 139,69,19 8B4513

burlywood 222,184,135 DEB887

ghostwhite 248,248,255 F8F8FF

mediumblue 0,0,205 0000CD

salmon 250,128,114 FA8072

cadetblue 95,158,160 5F9EA0

gold 255,215,0 FFD700

mediumorchid 186,85,211 BA55D3

sandybrown 244,164,96 F4A460

chartreuse 127,255,0 7FFF00

goldenrod 218,165,32 DAA520

mediumpurple 147,112,219 9370DB

seagreen 46,139,87 2E8B57

chocolate 210,105,30 D2691E

gray 128,128,128 808080

mediumseagreen 60,179,113 3CB371

seashell 255,245,238 FFF5EE

coral 255,127,80 FF7F50

green 0,128,0 008000

mediumslateblue 123,104,238 7B68EE

sienna 160,82,45 A0522D

cornflowerblue 100,149,237 6495ED

greenyellow 173,255,47 ADFF2F

mediumspringgreen 0,250,154 00FA9A

silver 192,192,192 C0C0C0

cornsilk 255,248,220 FFF8DC

honeydew 240,255,240 F0FFF0

mediumturquoise 72,209,204 48D1CC

skyblue 135,206,235 87CEEB

crimson 220,20,60 DC143C

hotpink 255,105,180 FF69B4

mediumvioletred 199,21,133 C71585

slateblue 106,90,205 6A5ACD

cyan 0,255,255 00FFFF

indianred 205,92,92 CD5C5C

midnightblue 25,25,112 191970

slategray 112,128,144 708090

darkblue 0,0,139 00008B

indigo 75,0,130 4B0082

mintcream 245,255,250 F5FFFA

snow 255,250,250 FFFAFA

darkcyan 0,139,139 008B8B

ivory 255,240,240 FFFFF0

mistyrose 255,228,225 FFE4E1

springgreen 0,255,127 00FF7F

darkgoldenrod 184,134,11 B8860B

khaki 240,230,140 F0E68C

moccasin 255,228,181 FFE4B5

steelblue 70,130,180 4682B4

darkgray 169,169,169 A9A9A9

lavender 230,230,250 E6E6FA

navajowhite 255,222,173 FFDEAD

tan 210,180,140 D2B48C

darkgreen 0,100,0 006400

lavenderblush 255,240,245 FFF0F5

navy 0,0,128 000080

teal 0,128,128 008080

darkkhaki 189,183,107 BDB76B

lawngreen 124,252,0 7CFC00

oldlace 253,245,230 FDF5E6

thistle 216,191,216 D8BFD8

darkmagenta 139,0,139 8B008B

lemonchiffon 255,250,205 FFFACD

olive 128,128,0 808000

tomato 253,99,71 FD6347

darkolivegreen 85,107,47 556B2F

lightblue 173,216,230 ADD8E6

olivedrab 107,142,35 6B8E23

turquoise 64,224,208 40E0D0

darkorange 255,140,0 FF8C00

lightcoral 240,128,128 F08080

orange 255,165,0 FFA500

violet 238,130,238 EE82EE

darkorchid 153,50,204 9932CC

lightcyan 224,255,255 E0FFFF

orangered 255,69,0 FF4500

wheat 245,222,179 F5DEB3

darkred 139,0,0 8B0000

lightgoldenrodyellow 250,250,210 FAFAD2

orchid 218,112,214 DA70D6

white 255,255,255 FFFFFF

darksalmon 233,150,122 E9967A

lightgreen 144,238,144 90EE90

palegoldenrod 238,232,170 EEE8AA

whitesmoke 245,245,245 F5F5F5

darkseagreen 143,188,143 8FBC8F

lightgrey 211,211,211 D3D3D3

palegreen 152,251,152 98FB98

yellow 255,255,0 FFFF00

darkslateblue 72,61,139 483D8B

lightpink 255,182,193 FFB6C1

paleturquoise 175,238,238 AFEEEE

yellowgreen 154,205,50 9ACD32

MySQL Backups

This article only covers backing up from the Command Linux (i.e., the shell, usually bash or korn (ksh) shells).

If you wanted to back up the database timsdata, you would simply use a command like:

mysqldump -c -u tim -p timsdata > *timsdata.sql*

This would create a file called *timsdata.sql* in the current directory. You should be aware that where I've entered the name tim in italics, you should specify another authorized user for the database.

Now you have a single file with all the sql to completely (the -c option specified in the command line) rebuild a new database. A command like:

mysql newdb -u tim -p < timsdata.sql

will create all the necessary tables in the database newdb. NOTE: This assumes that the user tim has permissions to the database and can create objects in the database newdb. It will fail if the user doesn't have sufficient permissions. See the reference manual for more information.

Patching Debian

Debian is a great Linux distro, and I'm not the only person who believes this to be true. I am not willing to discuss whether Debian is better or worse than any other linux distribution as that debate will take months or longer, and there are shortcomings of Debian like any other distribution.

That said, there is an easy way to ensure your copy of Debian is kept current with the latest security patches.

  1. Login as root (or more appropriately, su to the root account).
  2. Verify that the /etc/apt/sources.lst file includes the following line:

deb http://security.debian.org/ sarge/updates main contrib non-free

  1. Issue the command apt-get update to ensure the latest packages have been cached locally.
  2. Issue the command apt-get upgrade to actually perform the installation process.

Rarely will this require a reboot of the system, but if a kernel is being upgraded, a reboot should be completed.

Additional information is available from the main debian web site or any of the other web sites directly supporting Debian.

Cloning Debian

Sometimes when you're building a system, you want to be able to close the list of packages that are installed on another system.

Debian provides some great utitlities to manage their packaging system (apt, synaptic, etc). They also provide the dpkg suite of utilities as well. In this case, the command:

dpkg --get-selections

will return a list of packages that are currently installed on the system.

Likewise, their is a related command to set the selections on the target system. This is:

dpkg --set-selections

NOTE: This does not perform the actual installation!

You can now run dselect to start the installation with the packages you've selected and install the packages you want.

If you need to copy the list of files from one system to another, the exact steps are:

On system one (the source system you are cloning)

dpkg --get-selections > /tmp/packages.lst

Now connect to system two.

Perform a base install and select just a basic system. Make sure you install, as part of the basic system, the ssh packages if you are going to copy the file over a network from system one.

On the second system, run the following command:

scp user@computer:/tmp/packages.lst .

Notice the final character, the period, that means to copy the files from the remote system to the current directory on the local system.

Now run the command:

dpkg --set-selections < ./package.lst

Now running the command dselect will display the packages you've selected. Follow the menu prompts to perform the actual install. While you shouldn't have to reboot, this is a good time to reboot since you want to ensure all your services start up in the correct order and all the dependenices are solved.

Once the system comes up, don't forget to apply ALL security patches.