Windows: Using SUBST to Map a Drive Letter to a Folder

So you’re using some old app, like FoxPro and it points to a drive letter.  You only have one disk but need to spoof or mimic that drive letter.  Well, subst to the rescue.  Basically, pick a letter.  Let’s say S: as it’s not currently in use.  Then use the subst command followed by the letter followed by the path to map a drive letter to it.  For example, if you want tot mount up c:/sales as S: then use this command: subst s: c:/sales Now, don’t misuse this command as a replacement for, let’s say net use.  If it’s a network path still map it using the net use command…

Regular Expressions

Basically, a regular expression is a pattern describing a certain amount of text. Their name comes from the mathematical theory on which they are based. But we will not dig into that. Since most people including myself are lazy to type, you will usually find the name abbreviated to regex or regexp. I prefer regex, because it is easy to pronounce the plural “regexes”. On this website, regular expressions are printed as regex. If your browser has proper support for cascading style sheets, the regex should be highlighted in red. This first example is actually a perfectly valid regex. It is the most basic pattern, simply matching the literal text regex. A “match” is the piece of text, or sequence of bytes or characters that pattern was found to correspond to by the regex processing software. Matches are highlighted in blue on this site. b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}b is a more complex pattern. It describes a series of letters, digits, dots, underscores, percentage signs and hyphens, followed by an at sign, followed by another series of letters, digits and hyphens, finally followed by a single dot and between two and four letters. In other words: this pattern describes an email address. You can search through a text file to find email addresses, or verify if a given string looks like an email address. In this tutorial, I will use the term “string” to indicate the text that I am applying the regular expression to. I will highlight them in green. The term “string” or “character string” is used by programmers to indicate a sequence of characters. In practice, you can use regular expressions with whatever data you can access using the application or programming language you are working with.

On the Road: Travels with Charlie

I travel a bit for work, and so a part of this blog is going to be dedicated to those travels.  To start this off, I thought I’d cover a little of how I like to travel rather than little notes about where.  So when I fly I like to be unencumbered with my bags.  So I almost always check my bags.  Then when I see people running up and down the isles trying to get their gargantuan bags crammed into little cubby holes I can laugh at them…  Of course, this means I have to wait for my bag to come out on the carousel but that’s a small price to pay for such humor.  The humor I provide is in the form of frequent bathroom breaks (too much caffeine).  So don’t get me wrong, they can laugh at me too…  Given the bathroom breaks, I always sit on the isle (and therefore provide more humor to those around me as I get bashed on the elbow by the cart). Next, I always overpack.  Probably why I want to check my bags.  But I always bring at minimum one or two extra outfits.  In the IT field you never know when that 2 day job is actually 5.  I also bring my own shaving supplies, shampoo, etc.  I never think the hotel will have any of this.  Even the greatest chains get their Six Sigma efforts off and end up with a crappy hotel here and there.   Next, I always bring two or three batteries and a drive that I use to back up to.  Backing up days worth of information when you’re on the road is better than staying extra when that hard drive that’s been crashing around on planes finally dies on you after about 100 flights (and it will if it hasn’t). Next, always book your flights with your credit card.  Most cards (like my Amex) will allow you to cancel 30 days after the purchase and with IT you are typically making plans 1 to 2 weeks in advance. Finally, I only get a car when I have to.  I’d rather not.  Especially in cities like San Francisco where you’re packed in like sardines. Anyway, that’s how I roll.  How do you roll?

The Basics of pico (or nano)

At your Unix shell prompt, type: pico filename Replace filename with the name of the file you want to create or edit. For example, to create a file and name it indiana.txt, type: pico charles.txt If the file already exits, Pico opens it for you to edit. If it doesn’t exist yet, Pico creates it and places you in an editing buffer. Pico displays a menu bar of commonly-used commands at the bottom of the screen. Pico accepts commands from your keyboard but not from your mouse. To insert text into your Pico editing screen at the cursor, just begin typing. Pico inserts the text to the left of the cursor, moving any existing text along to the right. Each time the cursor reaches the end of a line, Pico’s word wrap feature automatically moves it to the beginning of the next line. (Also see “Justify.”) To move the cursor, use the arrow keys or use CTRL/f (forward), CTRL/b (back), CTRL/n (next line), CTRL/p (previous line). See the “Command overview” for more cursor movement commands. To delete the character to the left of the cursor, press BACKSPACE, DELETE, or CTRL/h. To delete the character highlighted by the cursor, press CTRL/d. To delete the current line, press CTRL/k. To save your edited file to disk, press CTRL/o. Pico displays the current filename. (To save the file under a different name, delete the filename that Pico displays and type a new one.) Press RETURN. To exit Pico, press CTRL/x. If you have made any changes since the last save, Pico asks whether to save them. Type y (yes) or n (no). If you type y, Pico displays the filename. (To save the edited file under a different name, delete the filename and type a new one.) Press ENTER. Pico lets you search forward from the current cursor position for any text string you specify. Press CTRL/w (for whereis) to invoke the search. Pico prompts you for a search term. To begin searching, type the text you’re looking for and press RETURN. Pico moves the cursor to the first instance of the text string you entered. You can find additional occurrences by pressing CTRL/w again. As you type, Pico’s word wrap automatically begins a new line when needed. However, when you edit existing text, you may create text lines that are either too short or too long. To re-wrap or “justify” a paragraph, move the cursor to that paragraph and press CTRL/j. To undo this action and restore the paragraph to its original condition, press CTRL/u. You can cut and paste text lines with Pico. Place the cursor on the first text line you wish to cut and press CTRL/k to remove it. (To cut and paste two or more consecutive text lines, press CTRL/k until all the text lines are removed.) You can now move the cursor to the location where you want to paste the text. Press CTRL/u. Pico pastes the text back into the file at the new cursor position. You can also cut and paste text blocks:    1. Move the cursor over the first character of the text you want to remove.    2. Press CTRL/^ to “set the mark.”    3. Use the arrow keys to highlight the text you wish to cut.    4. Press CTRL/k to cut the text. (Be sure you got all of the text you wanted, including the last character.)    5. Move the cursor to the place where you want to insert the text.    6. Press CTRL/u to paste the text into the new position. To insert the contents of an existing file at the cursor location, press Ctrl/r. Pico prompts you for a filename. You can either type the filename and press Return, or press Ctrl/t to select from a list of available files. Pico enters the File Browser, which displays a list of the files in your current working directory. Use the arrow keys to highlight the file you wish to insert and press Return. Select the parent directory (..) to move “up” the directory tree. Select a subdirectory to move “down” the directory tree. Besides inserting text, you can use the File Browser to rename, delete, or copy any file, even a file in another directory. To exit the File Browser, press e. To use the spell checker, press CTRL/t. When Pico discovers a word it does not recognize, it highlights the word and prompts you to enter a replacement. You can either type a replacement or press RETURN to keep the original word. Pico then continues to the next misspelled word. When Pico has checked your entire document, it returns the cursor to its original position. If your Pico session crashes, Pico attempts to save a copy of the file you were working on. Look in your working directory for a filename with the extension .save.   Some commands inside pico include the following keystrokes:     * CTRL/a Move to the beginning of the current line.     * CTRL/e Move to the end of the current line.     * CTRL/v Move forward one page.     * CTRL/y Move backward one page.     * CTRL/w Search for text (whereis).     * CTRL/L Redraw a garbled screen.     * CTRL/d Delete the current character.     * CTRL/^ Begin selecting text.     * CTRL/k Remove (cut) current line or selected text.     * CTRL/u Paste (uncut) last cut text at the cursor position.     * CTRL/j Format (justify) the current paragraph.     * CTRL/t Spell check the text.     * CTRL/r Insert (read in) a file into this file.     * CTRL/o Save (output) the file.     * CTRL/g View Pico’s online help.     * CTRL/x Exit Pico, saving the file.

Speaking at DefCon

This year’s DefCon seminar will cover the features and fundamental concepts of OS 10.3.4 Server. We will begin by describing the various roles of OS 10.3 SERVER in both small and medium sized offices. We will cover managing the webserver, email server and file storage. Finally, we will cover upgrading from 10.2 and data backup strategies. Bio for Charles Edge:Charles is a Senior Systems Engineer for Three18, Inc. and is a leader within the technical department and a mentor to the other field technicians as well as a trusted advisor to hundreds of Three18’s companies here in Los Angeles. His 10+ years of experience, coupled with his in-depth knowledge of IP Routing, MAC OS, Windows and Linux have made him a valuable asset to both Three18 and its prestigious roster of clients. Charles maintains certifications with Apple, Microsoft, Cisco and Comptia and is currently writing MAC OS X SERVER book for O’Reilly publishing, which should be on the shelves in early September 2004.