Tokina AT-X 100MM F/2.8 PRO FX MACRO

The AT-X 100 PRO D is an excellent 100mm F/2.8 macro lens capable of life-sized (1:1) reproduction at 11.8 in. (30 cm). The lens’ multi-coating have been re-engineered to match the highly reflective silicon based CCD and CMOS sensors in today’s digital SLR cameras. This lens gives the best of both worlds because optics still give full coverage and excellent sharpness with full frame sensors as well as 35mm film. The AT-X 100 PRO D also has a very convenient focus limiter switch that can lock the focus out of the closes focus making it focus faster when used as a moderate telephoto lens that is excellent portraits as well. Other features of the AT-X 100 PRO D are: Tokina One Touch Focus Clutch Mechanism for fast easy switching between manual and Auto focus. 55mm non-rotating filter thread for use with macro ring flashes and special effects filters. The AT-X 100 PRO D also comes with a deep bayonet mounted lens hood. Autofocus with this lens is not supported with Nikon DSLRs that do not have a focus motor in the camera body.

Things I like on Netflix

Psychokinesis (2018)
An ordinary guy suddenly finds he has superpowers he can use to help his spirited daughter and the people around them, but he also runs into trouble in the process.
Erased (2017) After finding his mom killed, Satoru’s time-traveling ability takes him back 18 years for a chance to prevent her death and those of three classmates.
Ash vs Evil Dead (2015) The series is set approximately 30 years after the first three Evil Dead films, and serves as a sequel to that trilogy. Ash Williams works at the “Value Stop” as a simple stock boy. Also working at the store is his friend Pablo and the object of Pablo’s affections, Kelly. Ash has seemingly done very little with his life since returning from 1300 AD at the end of Army of Darkness, and the beginning of the series sees him living in a trailer and drinking alone in bars. However, Ash must soon renounce his routine existence and become a hero once more by taking up arms and facing the titular Evil Dead. Pablo and Kelly decide to join him on his quest to save humanity.
Categorized as movies

How to set up Docker on Windows to use VMWare (instead of VirtualBox or Hyper-V).

  1. Get Docker:
  2. Get Docker Machine:
  3. Get vmware driver for docker machine:
  4. Extract docker zip somewhere (e.g. C:\apps)
  5. Copy docker-machine-Windows-x86_64.exe into the new docker folder and rename it to docker-machine.exe.
  6. Copy docker-machine-driver-vmwareworkstation.exe into the new docker folder.
  7. Run a shell (CMD or PowerShell) and add the docker folder to your path
  8. Run “docker-machine create –driver vmwareworkstation default”. This will download the boot2docker.iso and create a new docker machine named “default” in C:\Users\{username}\docker\machine\machines\default.
  9. Either:
      1. Run “docker-machine env default >default.cmd” to create a batch file that sets up the environment.
      2. Run “call default.cmd” to set the environment. This makes “default” the default machine for docker commands.
    • Or:

    • eval “$(./docker-machine env default)” from a UNIX-like shell such as cygwin’s mintty
  10. Now use docker. For example “docker version”.

Camera Lens Codes

I did not create this. This info was taken directly from this page at stackexchange.
I reproduced it here with some simplification because you can’t trust The Internet. Here today, gone tomorrow. Thank you to the many people who contributed this info to the community.

Descriptions by Lens Make



  • XYZmm: Focal length
  • f/x.y: Maximum aperture (or f/a.b-c.d for variable aperture zooms)

Focus/Mount Type

  • EF: Electro-Focus
  • EF-S: Electro-Focus, Short back-focus
  • EF-M: Electro-Focus, Mirrorless (EOS M)
  • TS: Tilt-Shift (manual focus)
  • TS-E: Tilt-Shift, Electronic aperture control
  • MP-E: Macro-Photography, Electronic aperture control (manual focus)
  • PE: Prohibitively Expensive


  • IS: Image Stabilization
  • USM: Auto Focus Type: Ultrasonic Motor
  • STM: Auto Focus Type: Stepping Motor
  • (Roman numeral) N: Version of lens (II = v2, III = v3, etc.) (The word Mark is not present in lens names, only in camera body names)
  • DO: Diffractive Optics
  • L: Luxury series
  • Macro: close focusing, but not necessarily 1:1 magnification
  • Softfocus ability to use soft focusing for smooth dreamy look
  • PF Power Focus (PF isn’t included in the official lens name published by Canon for lenses that include this feature)



  • XYZmm: Focal length
  • Fx.y: Maximum aperture

Lens Mount

  • X-mount: The modern, fully-electronic lens mount used in Fujifilm’s X-series cameras.
  • Fujinon: Fujifilm’s blanket term for its lenses which use this mount.

Lens Construction

  • XC: “Compact and casual” lower-cost lenses, generally with plastic barrels and a metal bayonet mount
  • XF: Higher-end lenses with metal body construction,
    usually faster maximum aperture, and often exotic lens elements (these
    are not usually called out by other designators in the lens name).
  • “Red Badge” or “Red Label”: XF lenses with the label in red; reserved for higher-end zoom lenses.


  • APD: Apodization filter for improved bokeh
  • LM: Linear Motor (faster than the standard motor)
  • Macro: Not necessarily “true” 1:1 macro; also found on lenses with 1:2 (0.5
Categorized as camera

French Press Coffee

I have the Bodum Chambord 34oz french press. Bodum says “all of our coffee and tea makers are measured in European cup sizes: 1 Cup = about 4oz.” If you fill the press up to the top of the upper metal band it’s about 32oz so the math works. My favorite mug is about 12oz so that’s closer to 3 cups for me.

My Perfect Brew

  • Water: 200 degrees (my electric kettle has a setting for this)
  • Coffee: 5 tablespoons medium roast (4 ish for dark)
  • Brew Time: 4.5 minutes
Categorized as coffee

FLUX 1440

FLUX 1440 is a clock for wall mounting with dimensions of 14 x 26 x 11 cm, which displays time mechanically through marks on a very long strip. - Felix Vorreiter
FLUX 1440 is a clock for wall mounting with dimensions of 14 x 26 x 11 cm, which displays time mechanically through marks on a very long strip. – Felix Vorreiter

MiiR Insulated Pint Cup

Upgrade Pint

Keep your beer cool, not your hand. Double wall insulation also makes this perfect for warm drinks when you add our lid.


  • Double wall insulation
  • Stays hot, keeps cold
  • BPA free
  • 18/8 Medical Grade Stainless Steel
  • Cup holder compatible
  • Dishwasher safe
  • Does not sweat

MiiR 64oz Growler

The King of Insulation

64oz of serious temperature blocking, carbonation saving, leak proof stainless steel. Your drinks will thank you.


  • Double wall Vacuum Insulation
  • BPA free
  • 18/8 Medical Grade Stainless Steel
  • Keeps liquids cold for 24+ hours
  • & hot for up to 12+ hours
  • Flip top, clamp style lid prevents leaks
  • Durable powder coat
  • Does not sweat

Nikon AF-S DX 35mm f/1.8G

Nikon AF-S DX 35mm f/1.8G

Compact, fast f/1.8 prime lens for DX-format cameras

Optimized for DX-format cameras, the compact, lightweight AF-S DX NIKKOR 35mm f/1.8G delivers the consistently stunning images you

Tokina AT-X 11-16mm F/2.8 PRO DX

Tokina AT-X 11-16mm F2.8 PRO DX

The new Tokina AT-X 116 PRO DX is an ultra-wide angle lens with a fast f/2.8 aperture for better photography in low-light situations. Many photojournalists consider having an f/2.8 aperture a must for any lens in their camera bag.

Based on the award-winning optical design of the AT-X 124 PRO DX (12-24mm f/4) lens, the new AT-X 116 PRO DX has a slightly shorter zoom range to maintain optical quality at wide apertures.


Tamron SP 180MM F/3.5 Di 1:1 Macro

Tamron SP 180MM F/3.5 Di Macro

The Tamron SP designation is reserved for lenses developed with special emphasis on extraordinary photographic performance. Engineers are free to innovate in an uncommon atmosphere where optical performance comes before price, resulting in lenses that satisfy the demands of discerning photographers.

A focal length of 180mm, 1:1 (life-size) macro reproduction, a fast, constant F3.5 maximum aperture and an optical formula featuring two LD (Low Dispersion) glass elements combine in a lens perfectly suited for extreme close-up shooting with an extended front element-to-subject working distance. The SP 180mm F/3.5 Di’s characteristics also lend themselves to indoor, close-range sports shooting and beautiful environmental portraiture. A special FEC (Filter Effect Control) function reintroduces ease to the use of a polarizing filter. Canon and Nikon mount-variants feature a focus ring with instantaneous switching between auto and manual focus for fine-focus adjustment.

Model B01
Lens Construction (Groups/Elements) 11/14
Angle of View (diagonal) 13°42’ for full-frame format
8°52’ for APS-C format
Lens Construction 14 elements in 11 groups
Minimum Focus Distance 0.47m
Max. Magnification Ratio 1:1
Filter Size Φ72mm
Length 165.7mm
Diameter Φ84.8mm
Weight 985g
Diaphragm Blade Number 7 (circular diaphragm)
Minimum Aperture F/32
Standard Accessories Lens caps

Microscope Adapter for Nikon Olympus D-SLR with 2X Lens


  • Model: A14NikonSLR
  • Material: metal
  • Compatible with Nikon D-SLR cameras: D100, D200, D300, D300S, D70, D70S, D80, D90, D7000, D7100, D7200, D50, D40X, D60, D5000, D5100, D5200, D5300, D5500, D40, D3000, D3100, D3200, D3300
  • Compatible with Olympus D-SLR cameras (the connection is a little bit loose): E-300, E-410, E-420, E-510, E-520, E-620, E-1, E-3, E-30, E-5
  • T-mount connection
  • Nikon/Olympus CMOS/CCD sensor with 2X lens equivalent to 12X~15X eyepiece (varys by CMOS/CCD sizes)
  • Standard 23.2mm 2X lens mount for most compound microscopes

Sigma 120-300mm f/2.8 AF APO EX DG OS HSM


Lens Construction 23 Elements in 18 Groups
Angle of View 20.4-8.2 degrees
Number of Diaphragm Blades 9
Mininum Aperture f22
Minimum Focusing Distance 150-250cm cm / 59.1-98.4in in
Filter Size (mm) 105mm
Maximum Magnifications 1:8.1 (at 200mm focal length)
Dimensions (Diameter x Length) 114.4mm x 289.2mm mm/4.5in. x 11.4in. in
Weight 2950g / 104oz.

OS – Optical Stabilizer Function
HSM – Hyper-Sonic Motor
APO – Apochromatic
EX – EX Lens
DG – DG for Digital

MTF Chart

Sigma 120-300mm f/2.8 mtf-chart

Sigma 120-300mm f/2.8 mtf-chart2


Sigma 120-300mm f/2.8 lens construction



Isn’t any synonym for unique an oxymoron?

Categorized as language

Peanut Butter Chocolate Oatmeal Stout

Added most of a container of PB2 chocolate to the fermenter with my Oatmeal Stout this time. It was a mess but taste testing before bottling did have a hint of the peanut flavor. I’m surprised because I have heard that you need to use a lot more than 1 container to get any flavour at all. I also used 2/3 cup white cane sugar for priming instead of brown sugar so I hope the bottles don’t explode. :)

Brewed 2014-11-15
Bottled 2014-11-29
Categorized as alcohol Tagged

robocopy, xcopy /j and eseutil /y

After reading a lot about the performance of the various copy commands for Windows, I did my own quick test. A Google search will most likely tell you that eseutil is the fastest of the three commands listed here but that’s not what I found. All tests involved copying an 18.4GB VM image over my 1Gb LAN with no other traffic. Source and destination machines are running 64 bit Windows 7 with SSD drives.

command time
eseutil /y 7 mins 7 secs
xcopy /j 3 mins 36 secs
robocopy 2 mins 57 secs

Theobroma 2014

Just got a 2014 Dogfish Head Theobroma from my local Whole Foods and I’m so disappointed. Last year it was amazing. The chocolate and chili really came through but this year it’s just weak. It tastes like Budweiser made it. So bad. 🙁

Categorized as alcohol Tagged

Oracle gather schema stats

-- gather schema stats for the "current" schema/user
    ,options=>'gather auto'

NATO Phonetic Alphabet and Morse Chart

A Alfa
B Bravo
C Charlie
D Delta
E Echo
F Foxtrot
G Golf
H Hotel
I India
J Juliett
K Kilo
L Lima
M Mike
N November
O Oscar
P Papa
Q Quebec
R Romeo
S Sierra
T Tango
U Uniform
V Victor
W Whiskey
X X-ray
Y Yankee
Z Zulu
Categorized as computers


Hawk in my neighbor’s yard, eating a small animal.
Hawk 2

Hawk 1


Displays the Resultant Set of Policy (RSoP) information for a remote user and computer.

gpresult [/s [/u [/p []]]] [/user [\]] [/scope {user | computer}] {/r | /v | /z | [/x | /h] [/f] | /?}

This command gives you a nice summary of which policies have been applied and where they came from.
gpresult /h report.html

What is the minimum size of a FAT volume in TrueCrypt?

So even though a TrueCrypt volume is supposed to have a minimum size of 275KiB for FAT, it appears to be a minimum of 292KiB on my 64-bit Fedora 14 box. This appears to include the TrueCrypt overhead since this is the size of the final file, not the actual logical volume. I am running the 6.3a version of TrueCrypt as downloaded directly from the main site.

My First Shot At Fyre

Fyre is a cool tool for generating art from chaotic functions. This is my first attempt at producing something of interest using it.

Digital Sand Painting

I was just thinking back on the days when personal computers were new and mine didn’t have long term storage. My friends and I would spend hours punching in machine instructions from Byte magazine. We’d go over them repeatedly to fix the inevitable mistakes. Finally we would be rewarded with a few minutes or maybe even an hour of a running program that we would hack on to explore it’s inner workings. And finally we would shut the computer down and lose everything. It was kind of like a digital sand painting.

Now days I wouldn’t dream of changing more than a few lines of code without saving. Of course most of the code I write is for my job and so it only makes sense to be careful. I’m also not that thrilled about the prospect of spending hours on a program only to throw it away but maybe I should be. In school we had programming contests where we were given from an hour to a few hours to solve one or more problems. Just like an IQ test, repeatedly solving the kinds of problems in the contest improved your score immensely.

Tibetan monks make mandalas out of sand to remind them of the impermanence of things. They aren’t trying to meet a deadline in fact they are doing their very best to build the highest quality product no matter how long it takes (often days). It’s amazing when you think about it, they strive for quality in producing a product that they know will be thrown away. Most of my job-related experience has focused on deadlines over quality and these are products that never get thrown away so you have to live with the consequences for a very long time.

I’m starting to work on those old contest problems again in my spare time with no deadline and no interest in preserving the code. I don’t know if my digital sand paintings will lead to any sort of epiphany but it certainly keeps your problem solving skills sharp. I suppose that happens for the monks as well unintended or otherwise. They undoubtedly increase quality with every sand painting and even though the painting itself is ephemeral, the person making the painting is changing permanently.

Asus P8Z68 Marvell SATA UEFI Blues

Well I am building a new computer after 6 years and I went with the Asus P8Z68. It took quit a bit of fiddling around to figure out but if you attach your DVD to the Marvell controller it will NOT recognize it as UEFI capable. Apparently it does not scan devices attached to the Marvell controller for efi info during the boot process. Devices on this controller do not show up in the typical EFI shell either.

USB devices work fine so thumb drives and external DVD drives connected to USB ports work. This is why it took me so long to figure out the problem. Everything BUT the Marvell controller seems to be scanned for UEFI.

So if you have an Asus Z68 board and you can’t get your DVD to boot in UEFI mode, move it from the Marvell controller to the Intel controller and it will work.

Fix Firefox

A quick list of settings that need to be changed on FireFox to get back some semblance of control over the cruft that is added with each new release.

DNS Squatting

Well Time Warner Business Class finally started squatting on my failed DNS lookups and even though they provide a page that is supposed to let you opt-out of the “service” of course it does not work.

Visiting NY

I’m in New York visiting the in-laws. Having fun and geeking out on Mike’s new Macbook Pro.


“We have top men working on it. … Top Men.”

Remote Desktop Connection keyboard shortcuts

Press this key To do this
Alt+Page Up Move between programs from left to right.
Alt+Page Down Move between programs from right to left.
Alt+Insert Cycle through programs in the order that they were started in.
Alt+Home Display the Start menu.
Ctrl+Alt+Break Switch between a window and full screen.
Ctrl+Alt+End Display the Windows Security dialog box.
Alt+Delete Display the system menu.
Ctrl+Alt+Minus Sign (-) on the numeric keypad Place a copy of the active window, within the client, on the Terminal server clipboard (provides the same functionality as pressing Alt+PrtScn on a local computer).
Ctrl+Alt+Plus Sign (+) on the numeric keypad Place a copy of the entire client window area on the Terminal server clipboard (provides the same functionality as pressing PrtScn on a local computer).
Ctrl+Alt+Right Arrow “Tab” out of the Remote Desktop controls to a control in the host program (for example, a button or a text box). Useful when the Remote Desktop controls are embedded in another (host) program.
Ctrl+Alt+Left Arrow “Tab” out of the Remote Desktop controls to a control in the host program (for example, a button or a text box). Useful when the Remote Desktop controls are embedded in another (host) program.

Octospider time

day tert woden feng nillet
1 8 64 512 4,096
1 8 64 512
1 8 64
1 8

1 day = 32 hours, 14 minutes, 6.2 seconds

Yes I was masochistic enough to read all 3 Rama books.

Categorized as books

Hard drive data recovery

I spent some time over the last week attempting to recover data from a friends laptop hard drive. The machine was dropped from a kitchen table (about 4′) while the disc was spinning and we think writing to the drive. The machine had Windows XP Home (really) and was formatted as NTFS. I never did get the partition table back and so was only able to recover files individually. Thousands of files (35,000 files @ 30GB) with auto-generated names. Figuring out how to put that Humpty Dumpty mess back together is a lost cause.

Booting from a Ubuntu Rescue Remix v9.04 CD, I was able to use Gnu ddrescue to image the drive to an external USB. When TestDisk failed to find the partition information for the main partition, I ended up using PhotoRec to recover as many files as possible. It took the better part of a week just to image the drive and run PhotoRec.

A new hard drive is currently on the way so I can get the machine up and running again. The original drive is still there in case I get a chance to try more aggressive techniques or better technology comes along.

As a personal reminder these are the commands I issued to clone the bad drive:

# mount USB thumb drive for log file
mkdir /tmp/flash
mount /dev/sdb1 /tmp/flash
cd /tmp/flash

# clone drive
sudo mount -t vfat -ouid=ubuntu,gid=users /dev/sdb1
ddrescue -n /dev/sda /dev/sdc logfile
ddrescue -r3 /dev/sda /dev/sdc logfile

Categorized as computers

Creating/Editing Excel files from the command line

I knew there was an automation object to do this but I never actually had to figure it out until today. I’ve used VBA to automate one app from another (Excel to create a Word doc for example). This little vbs script will update a cell on an existing spreadsheet with the first parameter passed to the script:

Dim objArgs
Dim val
Dim objExcel
Dim objWorkbook

Set objArgs = WScript.Arguments
val = objArgs(0)
Set objExcel = CreateObject(“Excel.Application”)
‘ relative paths do not seem to workat least not ones relative to the CMD interpreter’s current directory.
Set objWorkbook = objExcel.Workbooks.Open(“C:\temp\Book1.xls”)
objExcel.Cells(1, 1).Value = val

There is also an SQL way to do this that uses ADO but even in Excel 2007 it seems buggy at best. If you tend to think of everything like a database though it may be the way to go for you. In this case you open the spreadsheet as though it was a simple database table. By default the top row is assumed to have column headers. Turning that off was one of the many things that does not seem to work very well.

Dim objArgs
Dim szConnect
Dim objConn
Dim val

Set objArgs = WScript.Arguments
val = objArgs(0)
‘ relative paths seem to work with this approach
szConnect = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=””Excel 8.0″”;”
Set objConn = CreateObject(“ADODB.Connection”)
objConn.Open szConnect
objConn.Execute szSQL “update [Sheet1$A1:A1] set F1='” & val & “‘;”
Set objConn = Nothing

You can also do something like this to open the datasource.
objConn.ConnectionString = “Driver={Microsoft Excel Driver (*.xls)};DBQ=Book1.xls;ReadOnly=False;FirstRowHasNames=0;MaxScanRows=1”

Categorized as computers

Homebrew Chocolate Oatmeal Stout – part deux

So I did the math and since I had to buy all of the equipment my stout ended up costing $18.49 per 16oz. bottle! Of course, my next batch should only be about $1.70 per bottle.

When I bottled the beer it was 58 degrees with a specific gravity of 1.022. 58 is pretty close to the calibration temp for my hydrometer so no adjustment is needed. This gives us a potential alcohol of around 2.6%.

When I brewed and cooled the beer for fermenting it was 75 degrees with a specific gravity of 1.060. 75 degrees means we need to adjust the SG by 0.0018 which we’ll call 0.002. So we end up with 1.062. This gives us a potential alcohol of around 8.1%.

Subtracting 2.6% from 8.1% gives us a final alcohol percentage of 5.5%.

Categorized as alcohol Tagged


Who the heck does Adobe think they are automatically installing Air and with Reader?!?!?! And why in the heck is it necessary to have a thousand plugs-ins that are basically unused?!?!? It not only makes me sick it’s enough to make me consider never buying a copy of Creative Suite again and I love Illustrator! And how is it that the installer slows my machine to a crawl and what is this nonsense about “optimizing the install” that takes half of the time?!?!?

Categorized as computers

Homebrew Chocolate Oatmeal Stout

Well, my chocolate oatmeal stout is ready for drinking. It was brewed on May 3rd and bottled on May 17th.

I used a slightly modified version of the “Oatmeal Stout – 5 gallons, extract with grains” recipe by Stephan Galante from the October 1997 issue of Brew Your Own magazine (

Essentially I

  • added 5 tbsp of Hershey’s Special Dark cocoa
  • reduced the hops boil time by 15 mins
  • used brown sugar as priming sugar (for bottling)
Categorized as alcohol Tagged

LG enV2: nice phone, crappy software

I have an LG enV2 cell phone.

Why oh why Verizon does the list of “apps” that can be assigned to a shortcut key not include the notepad?

Why can’t I start the web browser with any home page I want? Even better, I would like to save my favorites on the phone instead of on your crappy web site!

Categorized as software

CTRL+ALT+DEL in Remote Desktop

CTRL+ALT+DEL = CTRL+ALT+END in remote desktop.

There are a few other shortcut key mappings in Remote Desktop. From the help file:


Categorized as windows

ASCII Characters

Chr Dec Oct Hex Chr Dec Oct Hex Chr Dec Oct Hex
(nul) 0 000 00 + 43 053 2b V 86 126 56
(soh) 1 001 01 , 44 054 2c W 87 127 57
(stx) 2 002 02 45 055 2d X 88 130 58
(etx) 3 003 03 . 46 056 2e Y 89 131 59
(eot) 4 004 04 / 47 057 2f Z 90 132 5a
(enq) 5 005 05 0 48 060 30 [ 91 133 5b
(ack) 6 006 06 1 49 061 31 \ 92 134 5c
(bel) 7 007 07 2 50 062 32 ] 93 135 5d
(bs) 8 010 08 3 51 063 33 ^ 94 136 5e
(ht) 9 011 09 4 52 064 34 _ 95 137 5f
(nl) 10 012 0a 5 53 065 35 ` 96 140 60
(vt) 11 013 0b 6 54 066 36 a 97 141 61
(np) 12 014 0c 7 55 067 37 b 98 142 62
(cr) 13 015 0d 8 56 070 38 c 99 143 63
(so) 14 016 0e 9 57 071 39 d 100 144 64
(si) 15 017 0f : 58 072 3a e 101 145 65
(dle) 16 020 10 ; 59 073 3b f 102 146 66
(dc1) 17 021 11 < 60 074 3c g 103 147 67
(dc2) 18 022 12 = 61 075 3d h 104 150 68
(dc3) 19 023 13 > 62 076 3e i 105 151 69
(dc4) 20 024 14 ? 63 077 3f j 106 152 6a
(nak) 21 025 15 @ 64 100 40 k 107 153 6b
(syn) 22 026 16 A 65 101 41 l 108 154 6c
(etb) 23 027 17 B 66 102 42 m 109 155 6d
(can) 24 030 18 C 67 103 43 n 110 156 6e
(em) 25 031 19 D 68 104 44 o 111 157 6f
(sub) 26 032 1a E 69 105 45 p 112 160 70
(esc) 27 033 1b F 70 106 46 q 113 161 71
(fs) 28 034 1c G 71 107 47 r 114 162 72
(gs) 29 035 1d H 72 110 48 s 115 163 73
(rs) 30 036 1e I 73 111 49 t 116 164 74
(us) 31 037 1f J 74 112 4a u 117 165 75
(sp) 32 040 20 K 75 113 4b v 118 166 76
! 33 041 21 L 76 114 4c w 119 167 77
" 34 042 22 M 77 115 4d x 120 170 78
# 35 043 23 N 78 116 4e y 121 171 79
$ 36 044 24 O 79 117 4f z 122 172 7a
% 37 045 25 P 80 120 50 { 123 173 7b
& 38 046 26 Q 81 121 51 | 124 174 7c
' 39 047 27 R 82 122 52 } 125 175 7d
( 40 050 28 S 83 123 53 ~ 126 176 7e
) 41 051 29 T 84 124 54 (del) 127 177 7f
* 42 052 2a U 85 125 55
Categorized as computers

Command line completion in Windows (like bash)

Here is the trick to command line completion in Windows. Open regedit and find this key:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar

By default the value is for CompletionChar is 0, set it to 9 (for <tab>) and you will have command line completion! This allows you to use <tab> to complete directory and file names so instead of typing C:\ThisIsAReallyLongDirectoyName, you can type C:\Th<tab> and the DOS box will complete the name for you.

One caveat. You must open a new DOS (CMD) window to see the effect. A window that is already open when you make the change will not show it.

P.S. – You can also change this setting using a GUI interface in XP if you install the TweakUI "power toy".

Return value of a command in sh/bash

The return value of a command executed in a bash shell is put into the variable "$?". For example:

ls gobbledygook
if [ "$res" -ne 0 ]
echo ls returned $res

Unless you have a file named "gobbledygook" in the current directory, this should print "ls returned 2". Note that I had to save the value of "$?" into my own var (res) immediately after the call to ls. Otherwise the very next command (if) would overwrite the value.

Manage Remote Desktop Sessions from the client

Ever try to log into a Windows machine using remote desktop and get the message "The terminal has exceeded the maximum number of allowed connections"? Well, this is a quick primer on how to determine who is using those connections and how to free up the inactive or locked ones. Essentially, there are two commands you need to know; qwinsta and rwinsta.

qwinsta (short for query windows instance) allows you to view the status of remote desktop (RDP) session for a given machine. The basic syntax you will want to remember is qwinsta /server:<server name>. For example:

c:\>qwinsta /server:fs-build
console 0 Conn wdcon
rdp-tcp 65536 Listen rdpwd
jqian 4 Disc rdpwd
rdp-tcp#27 cmckeachie 5 Active rdpwd

Here I ran qwinsta to see who is connected to fs-build. As you can see Jason and Craig are using the two remote sessions (and IDs 4 and 5 respectively). You will also see the console (on ID 0) and something called rdp-tcp (on ID 65536). The console is always there and represents the physical desktop window if you are sitting in front of the machine itself. The rdp-tcp guy represents the process that is listening for remote connection requests.

Because we do not pay for terminal server licenses, we have a maximum of 2 connections per machine (1 if it’s windows XP). So, if you want to log in to fs-build, you need to track down Jason or Craig and see when they will be done.

Now, there is one more thing you may notice in the output from qwinsta, the "STATE". You can see that Craig is "Active" but Jason is "Disc" (or disconnected). Basically, it looks like Jason was logged in but his session expired so even though he is logged in, he is not connected to the session. This happens when you lose connectivity to the machine (network down) or when you close the connection with out logging out of the machine. Let me just say, you should ALWAYS log off when you are done with remote desktop. It’s not enough to just click the close gadget on the window!

Ok, so let’s say we talked to Jason and he is in fact done with his session on fs-build. Now we need our second command, rwinsta.

rwinsta (short for reset windows instance) allows you to forcibly quit an RDP session on a given machine. The basic syntax you will want to remember is rwinsta /server:<server name> &#60ID>. For example:

c:\>rwinsta /server:fs-build 4

This command resets (or logs out) Jason’s session on fs-build. Note I had to use the ID for his session, not his username. This can take a while depending on how much he did during his session or how many things he left running. Once, the command returns (it does not print status or anything), I can verify that there is now an open connection by once again using qwinsta.

c:\>qwinsta /server:fs-build
console 0 Conn wdcon
rdp-tcp 65536 Listen rdpwd
rdp-tcp#27 cmckeachie 5 Active rdpwd

And I see Jason’s session is in fact closed.

So, qwinsta and rwinsta are pretty handy but please remember, rwinsta is powerful but it comes with responsibility. If you are an administrator on the machine you remote desktop into it is possible to reset just about anyone’s session. Make sure you check with the person before you do this. Don’t assume it's ok to reset a "Disc" session. That person may have a valid reason for leaving the session running (testing over the weekend for example or just being accidentally disconnected due to network hiccup).

Ok, if you’re bored, feel free to stop here. For those of you who are not asleep yet, there is a third command you may want to know about; tscon.

tscon (short for terminal session connect) is used to switch from one session to another on the remote (or local) machine. Basically, you log in to a remote machine and then use tscon to connect to another session. The syntax to remember is:

c:\>tscon <ID>

Why would you use this? Well, suppose you are connected to a remote machine and you get disconnected. If you try to reconnect, the RDP client is supposed to be able to connect you to your previous session but it often does not. If you have stuff running in that other session and you don’t want to start over, it’s tscon to the rescue. Once you are logged in using a second session, you would open a command prompt and use qwinsta to figure out your old session id. Then you use tscon to connect to that old session. Please remember, you are now using two sessions (our maximum for any one machine) on the remote machine so please complete your work quickly and log off. Also, you should do a little clean up. Once you log off of your original session, your second session is still out there so please be kind and kill it with rwinsta (or log back into it and out again using RDP client)!

P.S. – There is a GUI app that makes this stuff a lot easier but it is not usually found on your client machine (XP for me). Terminal Services Manager is the tool. There are other aspects to the three commands discussed in this email. I just outlined the ones you will probably find the most useful. Use "<command> /?" if you want to learn more.

ifstream/getline vs. FILE*/fgets (spoiler = use fgets!)

I was writing a small C++ utility which reads records out of a file and I decided to use an ifstream with the getline function. I compiled my program from the command line where my path, include and lib environment variables are set to use the Visual C++ 6 compiler.

In testing with an 80MB file, I noticed that it was taking up to 45 seconds to read the lines from the file. Just for fun, I decided to switch over to a FILE* with fgets and it took under 2 seconds! After a little more testing, I found that the VC6 compiler seems to have a bug with ifstream. When I compiled with the newer VC7 (from Visual Studio .NET 2003), the ifstream/getline combo was only about 2.5 seconds.

So, if you are using getline with an ifstream and compiling with the older VC6, I highly recommend switching to the FILE*/fgets combo!

The problem was almost as bad on UNIX (Sun 5.8) where using g++ ifstream/getline took 11.4 seconds and FILE*/fgets took only 2.5. There we don’t have a lot of compiler versions to play around with though so consider fgets the better option.

UNIX commands I can’t live without

g/re/p – print lines of a file based on regular expressions (very powerful text matching).

show me the top n lines of a file (by default 10).

Output Dump – view file contents as ASCII, HEX, OCTAL, LITERAL, two or more of each, etc.

Stream EDitor – read stdin or file and modify based on regular expressions to stdout. I mostly use this to do regular expression replaces but it is a programming language in it’s own right.

Sort the lines of a file into alphabetical order. (On UNIX you can do -u to make the output unique). Windows has a built-in sort command but it does not have anywhere near as many options.

show me the last n lines of a file (by default 10). (Can be used to continuously monitor a file with -f.)

Copy standard input to a file and to standard output.

TRanslate – change one set of characters into another, reading from stdin or a file. I use this a lot to replace single chars with line feeds to make files readable.

Try this in a Windows CMD shell to make sense of the entries in your path: SET PATH | TR ; \n

UNIQe – Show me only the unique lines in a file (assuming it is already sorted). Note that Excel can do this using the Data->Filter->”Advanced Filter” command.

Word Count – how many characters, words and lines are in a file? (Also what is the longest line?)

Allow more than 2 simultaneous downloads in IE 7

Increase the number of simultaneous downloads in Internet Explorer 7

Internet Explorer 7 will only allow you to download two files at one time. This limitation can prove to be quite an inconvenience for anyone who downloads quite a lot on the Internet. A simply registry tweak can be done to remove this limitation.

1) Click on the Start Pearl and type regedit in the Search Bar.

2) Once you are in the registry editor, navigate to the following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

3) Right click in the empty space, and create a new DWord (32-bit) value by choosing
New > DWord Value . Name it:

MaxConnectionsPer1_0Server (The 0 beside Server is a zero)

4) Double click this entry and modify the value to 3. (Substitute 3 for the preferred maximum number of downloads)

5) Create another DWord:


6) Once again, double click this entry and modify the value to 3.

If you have Internet Explorer open, just restart it and you should be able to have more simultaneous downloads running.

Of course, you

We begin

Ok, here is the basic stuff up front:

  1. Who is the blogger?

    I am currently a software developer doing my best to enjoy life and try not to worry too much about , the mortgage, the environment, the future, etc. In other words, waiting to win the lottery.

  2. What is he blogging about?

    This blog is where I hope to start collecting little tidbits I pick up, mostly related to technical things about computers. There may be some occasional social commentary, but that should be easy enough to ignore.