IE favorites, NTFS symbolic links and Dropbox
NTFS symlinks
Well-known to *nix-users, unknown to most Windows-users.
A file or folder can exist in more than one place, meaning the file is stored once to disk, but can have two different names on different locations. If you change it one place the change happens to the other place. I won’t bother going into details, but in short NTFS supports a few different ways to do this.
New in Windows Vista and Windows 7 is “NTFS Symlinks” which is a powerful way of linking files and directories between filesystems and over network in addition to the usual duality.
Dropbox
Dropbox is a great tool for synchronizing small amounts of files between computers (<2GB free).
Symbolic Link Creator
This application gives you a simple to use GUI for creating symlinks.
(Quick hint: Run as Administrator)
Synergy effect
Dropbox does a great job in synchronizing the dropbox folder, but it requires you to actively put files there. This is fine for all the stuff you can choose, but there are a few scenarious where you can’t do that easily.
In the picture above I have created a “_MachineSync” folder that contains a Favorites folder. By deleting my Favorites-folder in my user profile and linking in the Dropbox Favorite-folder all my IE favorites is synchronized to Dropbox. I’ve done the same on both my work PC and home PC, so now favorite items are instantly synced between home and work PC (as well as being accessible via web).
The same could be done with my documents, Desktop or anything else I’d like to keep in Dropbox. Just note that some folders require you to log on as a different user to be able to delete them before symlinking them in from Dropbox.
.Net GUI thread crossing
What is the GUI thread?
- Update the GUI.
Make changes in GUI objects like changing Text in a TextBox. - Read Windows Message Queue.
The WMQ is where Windows put all messages to the application like key clicked, mouse clicked, mouse moved, etc. - Repaint the GUI.
Taking the application from “code” to “graphics”.
The solution?
Timers
Do(nt)Events
Invoking GUI thread
private delegate void GUIInvokeMethodDelegate(Action @delegate); /// <summary> /// Invoke command with GUI thread. Usage: GUIInvoke(() => FormOrControl.Cmd()); /// </summary> /// <param name="delegate">Command to execute in form: () => Cmd()</param> public void GUIInvokeMethod(Action @delegate) { // Check if we need to invoke as GUI thread if (this.InvokeRequired) { this.Invoke(new GUIInvokeMethodDelegate(GUIInvokeMethod), @delegate); return; } // Execute @delegate.Invoke(); } // Sample method for invoking some code as GUI-thread public void DoThisAsGUI() { // Invoke some code (anonymous method) GUIInvokeMethod(() => { // Something you want to do in GUI thread. }); // Alternatively invoke a method: GUIInvokeMethod(() => SomeMethodThatRequiresGUIThread()); }
Slow YouTube
For the past 12-18 months YouTube has been slowing down dramatically for me. Around 18:00 I have to pause videos to let them download ahead, and around 20:00 there is no point in even trying.
So I ran some speed tests that showed my ISP (www.get.no) to be throttling the bandwidth for YouTube. I’m not sure how accurate these tests are. Anyway I fired off an email to my ISP asking why, and the reply was that the Scandinavian YouTube caching servers were overloaded.
From that I deducted that if YouTube has different servers for different regions (makes sense) they would either have to break internet routing standards so they can use one IP in several regions, have one gigantic NLB (Network Load Balancer) or they would simply spread the load using an intelligent DNS server.
Surely enough after having someone in the US do a DNS lookup I got confirmed that the DNS will round robin only a certain segment of the IP’s for me, and a whole different segment for the person in the US.
Solution?
I added the US YouTube IP to my local hosts file. This has increased YouTube to the point where I’m able to see 320/480 videos without pausing even during rush hour.
Another solution which I’m testing now comes from http://www.videoaccelerator.com/ – I’m trying out the free version.
Enabling Windows Firewall on Windows 2003 Active Directory Domain Controller
Some time ago I discovered that my (two) Active Directory controllers weren’t actually talking to each other too well. After some debugging I found that the local Windows Firewall was enabled on one of the AD controllers and it was basically blocking everything that had to do with AD. So I disabled it and all was well. All servers are located behind a firewall anyway, so the risk was minimal.
Now I thought it was about time to enable the firewall on my AD controllers again. And it turns out that, as usual, Microsoft lets the ports flow wild. There are three services that don’t have a fixed port: NTDS, NTFrs and NetLogon. Without a fixed port it is difficult to enable firewall for them. The local firewall can enable based on process, but my external can’t.
The good news is that you can set fixed ports for these services. This is described in the knowledge base article http://support.microsoft.com/kb/555381.
But who wants to read all that?
Here is the short version:
- Change registry to set fixed ports either by follow the knowledge base article or simply by running this .reg-file.
Note: As always when downloading .reg-files have a look at it first to see what it actually does.
Download, unzip, execute .reg-file, answer yes to question about importing it: - Reboot the AD-controller.
- Note that if all servers are on same subnet you can increase security a lot by setting Scope to “My network (subnet) only”.
Enable Windows Firewall and set the following rules:
- Repeat on all AD controllers you want to enable firewall on.
- Make sure you check Event Log on other servers for errors related to enabling firewall.
| Port | Protocol | Name | Notes |
| File and Printer Sharing | Already exist, must be enabled. NOTE: If servers are not on local subnet you may need to modify Scope. |
||
| 53 | TCP | DNS (TCP) | |
| 53 | UDP | DNS (UDP) | |
| 88 | TCP | Kerberos (TCP) | |
| 88 | UDP | Kerberos (UDP) | |
| 123 | UDP | NTP | |
| 389 | TCP | LDAP (TCP) | |
| 389 | UDP | LDAP (UDP) | |
| 3268 | TCP | Global Catalog LDAP | |
| 53211 | TCP | AD Replication | This was set by the .reg-file |
| 53212 | TCP | File Replication Service | This was set by the .reg-file |
| 53213 | TCP | NetLogon | This was set by the .reg-file |
| Remote Desktop | Optional: Recommended/required if you access server remotely. |
Enjoy!
Tip: Upgrading VS2008 projects to VS2010
Many of us are upgrading our projects to Visual Studio 2010 nowadays. You start Visual Studio 2010, load the project and the conversion wizard pops up. You click finish, try to compile and get a bunch of errors. Oh no!
The fact is that what Visual Studio version you are using is totally irrelevant to the code. If you are using .Net 2.0, 3.0 or 3.5 then the code should not change and Visual Studio 2010 should be able to execute it. But it doesn’t… Why? Because the conversion wizard is defect. Actually only the solution and project files needs to be changed, but the wizard often attempts to change a whole lot of code as well.
The solution is very simple: Convert the solution, but only keep the new solution and project files.
Step by step guide:
- Copy your project to a new folder.
- Open the new copy in VS2010 and let VS2010 convert it for you.
- Close VS2010.
- Copy all converted solution and project files to their corresponding place in the original folder. Files are *.sln, *.csproj, *.vbproj.
- Now open the original folder in VS2010 and everything will work just fine.
Alternatively if you are connected to a source repository like TFS, SVN or GIT then you can use the original code folder and then undo changes to all files except solution and project files.
BitLocker startup error 0×26000070
I’m using BitLocker for HD encryption on all partitions, USB disks and USB pens. For USB* it works fine by just asking for a password. But for HD encryption it is a bit more complicated.
Basically BitLocker should encrypt your HD without you having to provide any password at every startup. It should also be secure from tampering because if anything changes on the PC then it looses the key and you have to provide a recovery key/USB-pen.
Since I’m using a docking station for my laptop it kept asking me for recovery key at almost every reboot. I quickly discovered that this was related to the BIOS BOOT ORDER, where the docking station would sneak in some new devices. Simply telling BIOS that I only want to boot from HD fixed that.
Later I was so smart that I tampered with boot settings (BCD), and now I’m getting a 0×26000070 at almost every boot. The great internet contains very little information about this, but I managed with some lucky guessing to track it down to some PCI Express settings during boot. Something about using BIOS or OS IRQ settings?
Anyway, if you have this problem then try this: BCDEDIT /SET usefirmwarepcisettings false
BCDEdit /enum should list it as No.
Give it a couple of reboots and let me know how it went…