I spent some time searching for existing controls/frameworks for creating Vista-/7-style wizards in Windows Forms applications. The best framework I found was at http://bitbucket.org/factormystic/aero.wizard/wiki/Home. Also available on the site is a project for aero-style controls such as command links and search boxes https://bitbucket.org/factormystic/aero.controls/wiki/Home.
Tuesday, November 24, 2009
Tuesday, July 7, 2009
There are some occasions when you want to sign into the same site twice with two different user IDs. For instance you might be developing a new web application and need to compare how the application looks if you’re an administrator vs. a non-admin so you want to sign in twice to compare the two side-by-side.
In IE7 or under, you could simply click a shortcut to start a new instance of IE and the new instance would have its own session, but in IE8, they changed things a bit when they introduced their new process model. Now all the separate processes share the same session unless you explicitly tell IE to start a new session.
To do this, you open the file menu (press Alt if the main menu isn’t shown) and choose “New Session”. This opens a new IE window with its own session. As far as I know, the cookies are kept completely separate.
For those of you who like the command line, you could also run iexplore.exe (located in C:\Program Files\Internet Explorer by default) with the -nomerge parameter. This also means that you can create a shortcut to start a new instance of IE with a new session.
What I wanted though was to be able to right-click a link and choose “Open in New Session”. This is a little harder, but turned out to be easier than I thought. I originally thought I would have to dust off my C++ skills and finally learn to use COM (which I’ve tried my best to avoid), but all I wound up needing was an html file and a registry entry.
First, create an html file. You can simply right click the folder where you want to create the file and choose New → Text Document, then rename the file to something with an “htm” extension. I used C:\Program Files\NewSession.htm, though you can use any name or path you want, just make note of it when you create the registry entry.
Then open the file in your favorite text editor (i.e. Notepad) and copy/paste the following:
var a = external.menuArguments;
if(a && (a = a.event) && (a = a.srcElement) && (a = a.href))
var shell = new ActiveXObject("WScript.Shell");
shell.run("\"C:\\Program Files\\Internet Explorer\\iexplore\" -nomerge \"" + a + "\"");
Then save the file.
Note: Modifying the registry can be harmful to your computer if you don’t know what you’re doing. If you’re unsure of yourself or you simply want to be careful, it’s best to ask for help from a friend or associate with knowledge of computers.
Then start the registry editor by holding the Windows key and pressing R, typing regedit in the run dialog and clicking OK. In the registry editor, navigate to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt and add a new key named Open in New Session. Click this new key then double-click the (Default) REG_SZ and change the Value data to the path to your html file (e.g. C:\Program Files\NewSession.htm) and click OK. Then add a new DWORD (32-bit) value named Contexts and modify the value to set it to the hex value 20 (32 in decimal).
That’s it! you can close the registry editor and restart Internet Explorer. When you right-click a link, there will be a new option “Open in New Session”. When you click this option, a new instance of Internet Explorer will open with the URL of the link you clicked. This new instance will have a brand new session.
Monday, June 15, 2009
This might apply to previous versions of Word as well, but I came across some interesting tidbits related to resizing columns in Word 2007.
When you move the mouse in between two columns and get the column resize cursor, if you resize a column, in the middle of the table, it makes the next column wider as the previous column shrinks. If you’d rather resize the whole table, hold the Shift key as you resize.
Every now and then you might find that just the one cell resizes rather than the whole column – in this case, make sure the cell isn’t selected – when one or more cells are selected, the resizing only affects the selected cells.
Friday, May 1, 2009
If you have an <input type=”text” /> on your web page and that element currently is in focus, you can use this cross-browser function to retrieve the current position of the caret/cursor:
var range = document.selection.createRange().duplicate();
//moveStart returns the # of characters moved.
return -range.moveStart("character", -input.value.length);
Internet Explorer doesn't support the selectionStart property used by FireFox (I've heard Opera uses selectionStart and I believe Safari does as well) so instead we get the currently selected range via document.selection, use the selection object's createRange method to create a TextRange object which is what IE uses to manipulate text data. There doesn't seem to be a direct way to get the position of the TextRange within the parent object, but we can use the moveStart method to move the start point of the range. This method returns the number of characters moved, which happens to be the position of the caret - technically the negative of the position of the caret since you had to move the selection backwards to reach the start.
This method could easily be modified to get the ending position of the selection by using range.text in IE to retrieve the text selected (range.text.length would be the length of text selected) or use input.selectionEnd in other browsers.
Friday, April 10, 2009
I found a good tip at keyliner.blogspot.com that if you give yourself full access to the folders “C:\Users\Public\Desktop” and “C:\ProgramData\Microsoft\Windows\StartMenu”, you won’t get the UAC nags when you rearrange, delete, or customize items in your start menu. That was a huge annoyance for me since I like a well organized start menu.
Thursday, March 26, 2009
Wednesday, March 25, 2009
Online distribution is increasingly popular these days due to streaming services such as Hulu. It’s easy to watch what you want, when you want it. Cloud computing is taking us back to client-server days where the “cloud” (a bunch of servers) do all the computing and you interact with the cloud via a browser. Now there’s even talk about streaming video games.
The problem with online distribution is that the internet wasn’t built for mass distribution. Every time you request a video, a separate connection is made and the content is sent to you individually. For a few users or small requests, this works well and efficiently – the content is only sent to those who request it - but when you look at large numbers of users streaming large video files, the system starts to break down. Each user is using separate bandwidth whether they’re watching the same file or different files.
In contrast, TV services from your cable or satellite company are broadcast based. They send the same signal to everyone. They might use a lot of bandwidth sending all the channels to everyone and within each household, the vast majority of this bandwidth is wasted, however it’s much more efficient for a mass audience because the signal is only sent once. You can choose to tune in to the broadcast or not, but the bandwidth used it based on the number of channels being sent, not the number of users using the service.
The ideal distribution method would be a combination of the two ideas: Allow each user to request content, but allow download sharing. Rather than sending each packet to each user individually, send each packet once, but specify multiple addresses so the content can be shared.
Wednesday, February 18, 2009
A short list of the things I keep hearing about and want the most:
- An electric car. Even better would be a plug-in hybrid that can go around 60 miles on pure electric before needing to start the Internal combustion. That would mean I could go to work and back on electric-only, yet I could still be able to go on longer trips if needed. If I can’t have that, I’ll take a small electric car to get me to work and back and keep my current car for those longer trips. Photovoltaics on the roof would be great too – even if it couldn’t fully charge my car while I’m at work, it would still reduce the amount of juice needed when I plug it in.
- A new smart phone. I haven’t decided which one in particular, but I’d take a 32 GB iPhone, a phone running Windows Mobile 6.5 (like the HTC Touch Diamond2 or Touch Pro2) or one of the new Android phones like the Magic. I need it now, not in Q2!
- A flying car. I’ve been promised one of these in movies since the 80s. Where’s my flying car?