Symbolic links (symlinks) in Windows 7 or Vista

2011 January 14

One feature that was notoriously absent from Windows until recently was the ability to create symbolic links. A symbolic link is merely a small piece of code that is put in some physical location (DIR1) which tells the operating system to move somewhere else (DIR2) when software attempts to access DIR1. I use this feature regularly in OS X or other Linux distributions, mainly as a way to sync files through Dropbox without having to messily move where my software stores my files, although I also like shortening the absolute path to various directories that look like they were named by a scientist having too much fun with alphabet magnets on the fridge.

In Unix speak, this is quite easy– open up a terminal window and type:


This has finally been added in Windows Vista and Windows 7, but remains somewhat sloppy and confusing. Here is a very brief reference for those trying to do a similar thing in Windows, with emphasis on the flags.

mklink \PATHTO\DIR1\file.txt \PATHTO\DIR2\file.txt

You will be returned with:

symbolic link created for \PATHTO\DIR1\file.txt <<===>> /PATHTO\DIR2\file.txt

This is the most basic entry for creating a symlink between files. The one issues? This creates a soft link (essentially the same as creating a shortcut in Windows Explorer). If I am doing something like syncing my Keepass database, I will actually break this symlink because the software will not be forwarded to the file on a basic level– it will merely sit in the folder and go “where the hell is my database?” and either create a blank one or give some other error message.

To solve this problem we need to use the /H flag which tells Windows to create a hard link. A hard link physically points to the secondary location. You’ll want to use this option if you are trying to trick an application into looking for a different directory. For me, most of the time.

mklink /H \PATHTO\DIR1\file.txt \PATHTO\DIR2\file.txt

Now that’s how to symlink files– you need additional flags for directories. /D tells Windows that you are creating directory links, not file links. If you only use /D you will create a soft link. /J instructs the OS to create a “junction” which is (functionally) the equivalent of the hard links discussed above. In most cases I find myself using /D and /J before the link and target.

mklink /D /J \PATHTO\DIR1\ \PATHTO\DIR2\

Also remember, if you type “mklnk” at the command prompt, you will be returned with basic instructions for using the functions described above:

MKLINK [[/D] | [/H] | [/J]] Link Target

/D Creates a directory symbolic link. Default is a file
symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.
Target specifies the path (relative or absolute) that the new link
refers to.

Hopefully the above helps demystify the procedure a bit, however. read more to learn ways to improve your website’s rank on the internet.

iPhone data + iPad wifi = heaven!

2011 January 2
by Colin

I haven’t quite wrangled up the necessary funds to purchase an iPad yet– it seems that it’s not quite a niche that needs filling given I’m toting around an iPhone and a 13″ Macbook Pro wherever I go. However, one of the most discussed topics I see regarding the iPad is from novice Apple users who question as to whether or not it is worth paying for two cellular data plans; one for their iPhone, and one for their iPad.

There is a solution for some users if they are willing to take a few risks and modify the stock Apple OS. You can theoretically jailbreak your iPhone (if not already) and wirelessly tether the iPhone’s 3G connection so you can use surf on the iPad through the phone.

MiWi is an app (downloaded through Cydia for a one-time $20 fee, they also offer a free 3-day trial) that can setup your iPhone as a network access point (it will create a new “wireless device” that is available when you are using an iPad, laptop, etc.). Here’s a Wired article detailing the functionality of this “hack” (ironically the first thing that popped up on Google when I was trying to get to the MiWi home site). Now when you surf on your iPad, it routes the data transfer signal through your iPhone. Speed does not appear to be significantly degraded– you can easily still get up to 1 M/s download, so even streaming music or videos shouldn’t be a problem provided you have a strong connection to a tower (and you’re not in a location where 50,000 people might be trying to access that tower!)

If you go this route you just have to be careful about data transfer. MiWi keeps track of it for you, and you have a couple of options for visualizing it. Data transfer is key because new iPhone customers are likely on a tiered data pay structure– they have monthly transfer caps of either 200 MB ($15) or 2 GB ($25). I (and I assume many early iPhone adopters) am grandfathered in with an “unlimited” AT&T plan (which will eventually turn out to be like Comcast’s version of “unlimited” but for now you can’t beat it)– these individuals should be salivating at this post by now. Regardless of plan, you can obviously run up a few hundred megabytes very, very quickly browsing, so you might want to up your iPhone data transfer cap if you are at the bottom end their plans. However, this $10 bump would still be much cheaper than buying a whole new data plan for the iPad.

I/O Error? OS X Hard Drive Failing…

2010 December 27

My Macbook (late 2008 Unibody) turned two years old a few days before Christmas. The day after it’s birthday (the only reason I know this is because I was checking where it fell in terms of warranty, but AppleCare is only one year, not two from purchase date so this was pretty irrelevant anyways) I started to suffer from a myriad of issues during use. Beachballing. Bouncing programs in the dock. Random freezes in Firefox when browsing. Connection dropouts. The works. I initially thought this was the work of an outdated program failing to play nice with the newest version of Snow Leopard (10.6.5) which I had installed days before. I began turning off plugins in Firefox and ditching programs from the startup menu to attempt to cure whatever sickness had taken over my laptop. Every reboot cycle gave me the same problem– the computer would run for about 30 seconds, but then any use and it started beachballing. Finally, it just didn’t reboot. The computer hung at the grey screen with the Apple logo and the spinning ball.

Hanging gray Apple boot screen

No peripherals (external hard drive, USB mouse, etc.) were attached so that was immediately ruled out. To attempt to diagnose the problem, I attempted to boot into safe mode. Not happening. Tried resetting the PRAM and NVRAM. Nada. Finally, the next series of steps allowed me to salvage my hard drive and let my Macbook live to see another day (minus a $700 data recovery charge).

Boot into single-user mode (sometimes called verbose mode) (hold down Control-V as soon as the Mac chime sounds after pressing the power button). You should now be in an environment that looks like this:

Single-user mode environment

At the command line type:
/sbin/fsck -fy
and press Return.

You will receive messages about the disks use and fragmentation as fsck will now go through five phases of disk utility. If you get:
disk0s3: I/O Error
then you have a problem with bad sectors on the hard drive.

Eventually, fsck will probably tell you:
Repeat the fsck process above.

Keep repeating the above process until
does not appear.
Even after this message disappears, repeat one more time. If this message doesn’t disappear, and you continue to get disk0s3: I/O Error or similar errors, it might be time to think about punting the hard drive (or visiting a data recovery specialist if you don’t have a backup).

Type reboot at the prompt.

You should be able to boot (hopefully). If you can, find an empty external hard drive. If it’s big enough (more than 2x the size of your internal drive, which most on the market nowadays should be), I highly recommend doing three things (you can partition it into 2 OS X Journaled drives for total safety, although this should work.

1.) (optional) Run Onyx maintenance scripts
2.) Clone the internal hard drive with Carbon Copy Cloner.
3.) Do a brand-new, full backup using Time Machine.

This may seem redundant (backing up your now-functioning hard drive at it’s present state twice), but there have been sporadic issues reported in the past with Time Machine backups having issues backing up drives with I/O errors. Secondly, CCC will provide you with a bootable copy of your hard drive. Why is this important? Well, if you had I/O errors during this ordeal, it’s extremely likely that your hard drive is on the way out. You may have salvaged it for now, but with 2.5″ HDD prices being under $100 these days (even their SSD cousins are coming down) you might as well drop the coin and upgrade the hard drive.

Hard drives for Macbooks are simple to replace (iFixit will walk you through the steps). You can then either restore your Macbook via Time Machine and the OS X install disk, or, more preferably, boot onto your external partition (hold down Option right after the Mac chime sounds during bootup, select external hard drive) and then clone that partition over to your newly installed hard drive using CCC (essentially the same but reverse as you did before).

Music from House, “A Pox on Our House”

2010 November 18
by Colin

Season 7, Episode 7, Aired November 18th, 2010.

The song during the closing credits was by The Black Ryder entitled All That We See (Amazon) (YouTube). It’s from the album “Buy the Ticket, Take the Ride.”

Danielle about to drop the bomb– on some fishes

2010 August 23

There is virtually no chance of this system coming within a couple hundred miles of any landmass outside of Bermuda, but Danielle is getting ready to go on a romp in the central Atlantic. Really has developed rapidly today, with [url=""]Dvorak[/url] estimates at 4.0 from the TAFB and 4.3 from CIMMS ADT (U of Wisconsin algorithm) as of late this afternoon.

Danielle vis satellite 2010-08-23

Danielle 85 GHz  2010-08-23

The former image is just the visible satellite from 1945Z, the later is a microwave pass at 85 GHz (1620Z) which shows that there is a nice eyewall developing under the CDO. Should pop out overnight tonight as it clears out the core, and, combined with decent SST’s and a (fairly) low shear environment, there’s a real chance this might be a major hurricane (115+ mph MSW) before tomorrow is done. SHIPS seems to agree with big percentages for RI (54% for 25 kt, 34% for 40 kt).

TD1 in the next 12 hours?

2010 June 25

Low level circulation (LLC) encompassed by my awesome MS Paint skills. Second pass did a much better job defining a closed circulation. Looks like they are taking one more pass on their way back to the States.

Recon pass

Vis sat, 93L, Friday PM

Looks pretty healthy on the visible. 850-200 mb shear has weakened today, good outflow, fairly deep convection sitting right over the recon LLC fix. Really would be shocked if the NHC didn’t call this TD1 (or even TS Alex) in the next 12 hours or so. There is no doubt that they have been/will err on the side of caution, especially with it so close to land (I’m sure they’re trying hard not to name a borderline system solely out of the reaction it will garner along the Gulf coast and in the mass media) but I can’t fathom this system not being a TS before initial landfall in 36 hours. No use holding off if that’s the case.

Yet another geography lesson for Fox News

2010 June 25

Apparently Fox news thinks there are not one but TWO systems in the Gulf of Mexico.

The National Hurricane Center (NHC) warned Friday morning of not one but two weather formations in the Gulf of Mexico, both with the potential to swell into more serious weather systems. Responders in the Gulf of Mexico are eyeing the storm system closely, to see whether it turns towards the Gulf and interferes with ability to mop up spilled oil and cap the leaking well.

There is a 70 percent chance that the low-pressure area centered off the coast of Honduras could become a tropical cyclone during the next 48 hours, warned the NHC, indicating winds as fast as 73 mph. Any faster and the storm could officially become the first Gulf hurricane of the season — and will be named Alex.

Meanwhile, a smaller weather formation just East of the Northern Leeward Islands is also being eyed. NHC describes it as “a large but disorganized area of cloudiness and showers … associated with a tropical wave interacting with an upper level trough.”

Apparently Honduras and the Leeward Islands are now part of the Gulf of Mexico coastline. Good to know. And either Joe Bastardi is even more of a hype-machine than even his biggest detractors thought, or people at Fox have confused the hurricanes with tropical cyclones or the Gulf of Mexico with– you know– the entire Atlantic Basin.

Bastardi believes we’ll see as many as 21 hurricanes in the Gulf area, which means “you may see a naming orgy this season,” he predicted. Hurricane season for the western Atlantic and the Gulf of Mexico begins June 1 and lasts through Nov. 30. That’s when about 90 percent of the storms make themselves present.

FTR, 21 hurricanes would absolutely shatter the Atlantic record of 15 set in 2005. They (he?) meant named systems.

Screenshot (with annotations!) saved below for posterity. Click for full size.

Fox News doesn't know where the Gulf of Mexico is

Invest 93L: do we have a problem?

2010 June 25

Invest 93L has had a pretty nice low-level circulation (LLC) going for a day or so now– the problem is everyone’s been worried about the convection south of Jamaica trying to develop a mid-level swirl when our LLC had been a couple hundred miles to the SW.

93L #1

93L #2

This afternoon it looks like our convection is propagating towards our LLC and our LLC is even retrograding back towards the height falls caused by the convection. A symbiotic relationship that can only happen in a wonderfully low shear environment!

93L #3

Speaking of shear, we can see the storm’s in a bulls-eye for low 850-200 mb shear (yellow contours, low numbers means less shear = good for tropical cyclone development since the warm core can become vertically stacked). Broad (albeit weak) area of satellite derived cyclonic vorticity in the area (orange contour) which is a good sign as well. However, strong sheer exists across the Yucatan channel (20, 30, 40 m/s yellow contours at the top of the images). Unfortunately for potential Alex or fortunately for Gulf residents, this is really the only conceivable path a landfalling system could follow if it were to develop and make it into the Gulf as anything of any substance. Two models (GFS and CEM) I quickly looked at don’t lift this shear out of the area anytime soon (see below, the pink colors across southern Gulf and Cuba — the two images are for Friday night, but there’s not a whole lot of movement through day 3). Although a few models really blow this system up and show a landfalling cyclone in LA/MS, I just can’t see that unless the models are doing a bad job of the synoptic environment (and they theoretically should have a much better handle on that than the actual cyclogenesis). Should the storm follow the dynamical models that move it NW, any deep convection will be quickly sheared away and the central dense overcast (CDO) will separate from the LLC.

It’s only bet for survival (if the models verify) would be to trek southward (weaker storms are more easily steered by low-level flow anyways) across the Yucatan and into the Bay of Campeche. With this track, it’s unlikely a cyclone could spend enough time over open water to really maintain any symmetric core.

93L #4

93L #5

So we might have TD1 or even Alex in the next 24-48 hours. However, unless I see otherwise, I’m highly skeptical of the “doom and gloom” potential SOME people are already trying hard to pick up on. Whatever is forming, it looks highly probably we’ll see it cross the Yucatan, emerge in the Bay of Campeche, and then likely move inland over central Mexico a few days later.

Timed shutdown in Windows?

2010 May 22
by Colin

I recently came across the issue where I was syncing a large number of files to my Dropbox computer at my office– unfortunately, I had an appointment I needed to get to and couldn’t spend an hour waiting for 4,000 files to get uploaded. My options were to shut the computer down (and not have access to the files until the next day) or leave the computer running all night (with logged in credentials). Or were they? Few people know that Windows actually has a built in shutdown timer within the DOS prompt.

Press the start button, click on Run, and type “cmd.” Press enter.

The shutdown flag allows you to shut down (or restart) either a local or remote machine. Used without parameters it merely logs the user off. However you can add…

-l : Logs off the current user, this is also the defualt. -m ComputerName takes precedence.

-s : Shuts down the local computer.

-r : Reboots after shutdown.

-a : Aborts shutdown. Ignores other parameters, except -l and ComputerName. You can only use -a during the time-out period.

-f : Forces running applications to close.

-m [\\ComputerName] : Specifies the computer that you want to shut down.

-t xx : Sets the timer for system shutdown in xx seconds. The default is 20 seconds.

-c message : Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters. You must enclose the message in quotation marks.

-d [u][p]:xx:yy : Lists the reason code for the shutdown. The following table lists the different values.

For example, when you use the command window and type…

shutdown -s -f -t 3600

… it shuts down the machine (-s) while forcing applications to close (-f) in one hour (-t 3600).  Helpful for situations like the one I outlined above or when you are streaming a movie to an external monitor and don’t feel like getting out of bed after realizing “Jeez, even pirating Couples Retreat was a huge waste of time.”

A beginner’s guide to atmospheric shortwaves

2010 February 17
by Colin

My note: This was originally written on Sons of Sam Horn on December 29th. I have slightly modified it, but it still is rather raw. It is not meant to be an exhaustive or textbook-level discussion of atmospheric shortwaves, but is intended for non-scientists who want a little more than what their TV weatherman tells them. That said, it’s always nice to have my work published on my domain so it’s now here for posterity, I also wanted to let you guys know about the new Ivy and Wilde furnish pieces I have gotten, I want to recommend all of you to head out to their website and check them out.

What’s an S/W? Is that a shortwave? What does a shortwave look like on one of the maps that get posted?

We’ll start with the first question. Yes, S/W (sometimes written SW– which is obviously confusing to those of us who also care about directions– which is, well, all mets) means “shortwave.” A shortwave is essentially a “kink” in the large-scale upper level trough/ridge system.

For examples, I’ve pulled some output from the last 84-hr NAM run. Below is the 300 mb map at 30-36-42 hours from model spin-up (18Z Wed, 00Z Thu, 06Z Thu) which is Wednesday afternoon through about 1 AM Thursday AM. Color contours are wind speed, arrows are wind direction (length corresponds to magnitude) and the line contours are height contours (you can think of higher heights being higher pressure and lower heights being lower pressure– they are the height in geopotential meters that you find the 300 mb pressure level for a given X/Y (lat/lon) location).

NAM 300mb animation

There are a couple prominent shortwaves in the trough. One begins in ID and makes its way down to the NE/CO/WY border by the end of the run. The one we’ll focus on begins in KS/OK and makes its way up through IL into IN by 42hr.

Here’s a better look; from now on we’ll freeze at 36hr (00Z Thursday).

NAM 300mb

You can see the counterclockwise kink in the white (height) contours very well in this picture. You can see hints of it as far north as Minnesota and it almost parallels the Mississippi River all the way down to the gulf coast. Shortwaves (like this one) are usually formed by cool pools aloft and upper level fronts.

There are phenomenon associated with shortwaves that are evident at all layers in the atmosphere. Next is the 500mb map, which shows color contours of “vorticity.” Vorticity is essentially the amount of rotation an infinitesimal parcel of fluid has.

NAM 500 mb

We can see a brightly colored area right in the region of the most “kinkage.” This is conceptually expected. The smaller radius of curvature at the bottom of the kink implies more vorticity since the an air parcel following the curved contours would need to rotate more than one following non-curved contours. Also, from now on I will refer to positive and negative vorticity. In this graph the “warmer” the colors (reds, oranges, and yellows) the more positive the vorticity. The way I tell most people to keep it straight is (in the NH) positive vorticity = good for rising motion = exciting weather (storms) = cyclonic = counterclockwise. On the downwind (eastern) side of the kink we get what is called “positive vorticity advection.” For those not familiar with advection, it is (essentially) the transport of a fluid property from location X to location Y. Here, we see the wind is blowing from Kansas through Arkansas and up the Ohio River. Positive vorticity advection is occurring around the Mississippi River (east of the big yellow bulls-eye) because the highly positive vorticity is being transported (via wind) eastward. In simplistic terms, advection can be thought of as the derivative (d/dx) or gradient of a field. If you have no gradient, you have no advection because you’ll just replace your parcel of air with another parcel of air with the same properties (vorticity, temperature, moisture, whatever property you want to advect). However, if the gradient is steep, then you will notice rapid changes as air travels to and then through your location because you are transporting air that is very different than what was previously in the region (high magnitude of advection).

This kink also causes another type of advection. Temperature advection. Meteorologists typically like to look at the 850 mb map to see this.

NAM 850 mb

Here we same the same thing as vorticity. The color contours are temperature (warm colors are higher) and the white arrows are wind. In the black circle we see the wind “blowing” from warmer air to cold. Therefore, in regions like Arkansas, warm air advection (WAA) is occurring due to the shortwave– it’s causing warm air to be transported into a region where cooler air previously existed. Over time we expect to see temperatures rise. You are also seeing cold air being advected BEHIND the kink (KS/OK). This is called cold air advection (CAA). The WAA and CAA are what cause the thermal gradients more commonly interpreted as “warm fronts” and “cold fronts.”

So why is this all important? Well, in very simple forecasting terms, both WAA and positive vorticity advection (PVA) are associated with rising motion in the atmosphere (there are a lot of very complicated dynamical reasons this is the case; I have spent 6+ years learning all of this so it’s not something I can really delve into the “why” of on a blog). Not surprisingly, our shortwave is associated with both of these lifting mechanisms– lifting implies latent heat release through condensation and we typically see precipitation. Well do we? I’ll show one last chart. This is the surface map with QPF (precipitation) in color contours.

NAM 1000 mb

Voila. We have precipitation in the area of our shortwave! Now there’s a couple small issues with this. One, this precip is actually the accumulated rainfall over the past 6 hours (30hr-36hr). For it to “line up better” with our other charts above we would have to average the “before” and “after” (36hr-42hr) QPF to get one centered on 36hr. Two, the shortwave is part of a complicated system; it may the main driver, but it isn’t working alone and is always interacting with the atmosphere. For instance; we see the heaviest precipitation a bit further south than we’d expect given the vorticity plots. Well from just a quick glance at the maps (don’t worry– I didn’t point this out earlier so as not to confuse the topic at hand) there is some upper level jet divergence near the Gulf Coast which is enhancing the vertical motion (and hence rainfall). We also expect QPF to be highest near the warm Gulf waters because there is a greater moisture flux from the surface to the atmosphere there (which means higher vapor pressures, more rapid condensation and more precipitation).

If all these features persist as the shortwave moves and they continue to work the way they need to; we increase baroclinic instability: instability driven by temperature gradients in the atmosphere (which is a result of the WAA/CAA as well as the rising motion induced by factors such as vorticity advection). This creates an energy source that can intensify tiny shortwaves into powerful mid-latitude cyclones. Now, this is an extremely simplified conceptual model; and isn’t EXACTLY how big nor’easters form (which is obviously more complicated; otherwise you could get a met degree in 6 weeks ;) ); but it should give everyone a broad understanding of the dynamics at play and how to spot a few of these features on either weather maps or model output.