Disclaimer: All postings are provided "AS IS" with no warranties, and confer no rights. This weblog does not represent the thoughts, intentions, plans or strategies of Microsoft. Because a weblog is intended to provide a semi-permanent point-in-time snapshot, you should not consider out of date posts to reflect current thoughts and opinions.
I have an old Toshiba that has no optical drive. To install Win7, I needed a bootable USB stick. Here are the basic steps
0. Download Win7 http://www.microsoft.com/windows/windows-7/
1. Get a USB stick – need a 4 gig one here – the ISO is about 2.5 GIG
2. Format the USB as NTFS (use quick – no need for sector check) – it MUST be NTFS
3. Run DISKPART from an elevated command prompt
4. Make the new USB volume “ACTIVE”
5. Extract the Win7 ISO somewhere (not the USB) – you can use ImgBurn, IsoBuster, WinRar or some tool that can extract direct from an ISO – or mount with Daemon tools or similar, then copy the files from there. We need to extract first as we’ll need to run a quick program off of the Win7 ISO
6. On the recent Win7 extract, change to the BOOT subdirectory
7. Run BOOTSECT /NT60 <targetDrive:>
where , <targetDrive> is the drive the USB stick is mounted as….
8. Copy all the files from step 5 above to the ROOT of the USB stick (with subdirectories of course)
Now, you may be able to skip step 5 copying files across and running BOOTSECT directly – I hadn’t but doesn’t necessarily mean it won’t work.
This set of posts is about a "Mini URL" service that I created initially to help provide a means to automate shortening of URL's for sending in emails to users in SharePoint. If you've used SharePoint and at times you need to send a link to a List or Document item one way is to "right-click" the item (whether it's a folder, list item, or document) then if it's IE choose "Copy Shortcut". You can then just past that into an email and send over to your recipient.
Recently, I also noticed that even the White House Tweets (http://twitter.com/whitehouse ) are using another well known URL shortening service. A quick look around and you'll see that there are quite a few out there now.
So, I stripped what I built into very basic ASP.NET Web Site and created a service that is now hosted at GoDaddy at http://MyMiniUrl.net. This intended as a pure demo project and the full SharePoint integration won't initially be made available until I work out some minor issues – mostly related to "packaging". But for now, I wanted to just document some of the initial steps, challenges, and work-around that I encountered building this along with some of the decisions (trade-offs) I made along the way.
The initial technical goals of the service are as follows:
The SharePoint integration aspect, not yet provided here, is implemented as an ECB (Edit Control Block) menu option that allows immediate automated generation (or lookup if the URL has been shortened already) then presentation of a quick Application page that allows the user to specify an email or pick from People Picker to send out.
Again, I've not published that part of this yet until I address a few issues.
Part 1 – Part 2
The first order of business is what URL shortening approach should be used to take some very long URL, which in IE7 is limited to 2,083 characters (KB208427) and provide a nice compact link.
The first part of the link (protocol + server + port) is generally controlled by what domain name you can get – for me, my little demo is http://MyMiniUrl.net. The rest of the URL – the path is something in your control.
Doing a search I came across a few approaches but settled on a Base 62 approach that uses a sequence generation maintained in the persistence tier. The idea is to generate a unique sequential number, then convert that numeric to a Base 62 representation. For the sequence generation, I just relied on the DB layer (MySql or MS SQL) to generate this from an identity column.
Once that identity value is generated, it gets run through a Base 62 conversion to a string representation. That string along with the identity (from the DB), the full Long URL, and a cryptographic hash of the Long URL is stored in the DB. The basic DB table schema is as follows (for MySQL):
Shortened “path” of the URL
Crypto hash of Full URL using MD5
Full URL provided
The indices are as follows:
So, when the URL service is asked to create a short URL, it first checks to see if the URL was already generated. To do that the UrlService uses the basic pattern:
Now, for the Base 62 algorithm, I looked around at a few approaches, and Chris had a good post on various approaches as well �� Friendly Unique Id generation.
Starting with his code, I also found another approach located here, then finalized on the following:
static int baseNum = 62;
private static readonly String baseDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
public static string Base62ToString(long fromValue)
string toValue = fromValue == 0 ? "0" : "";
int mod = 0;
while (fromValue != 0)
mod = (int)(fromValue % baseNum); //should be safe
toValue = baseDigits.Substring(mod, 1) + toValue;
fromValue = fromValue / baseNum;
The basic approach is to loop through the source value, grab the remainder, convert that remainder to Base 62 and append it to a string return value, until there’s nothing left.
So, in terms of “string” vs. StringBuilder performance, I also tried using StringBuilder in place of string concatenation, but performance, in a loop of a billion iterations was far better (about 60%) just with simple string concatenation. Now, I’m not too concerned with garbage collection at this point, I just wanted something quick and efficient – and in the end correct.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Enterprise Library v4
If you’re needing access to MSDN library from a 3g tethered, or low bandwidth at a location, MSDN Library is now published in a mode that lowers the payload…
Much more detail on Scott Hanselman’s blog on the HOW…