How To: Setting Up Database Mirroring on SQL Server 2005
After fixing a SQL Server naming issue, I was ready to continue on with my SQL Server 2005 database mirroring project for my client. The resources for setting up database mirroring are very light across the web so I decided I would help others out by writing out a "how to" guide. First, here are some assumptions that this guide uses which mimics the environment my client had for this project -
- All of the servers involved are joined to the same domain.
- You will be using a Principal server, a Mirror server and a Witness.
- The Principal and the Mirror servers are the same version of SQL Server 2005 (in this case, all Standard Edition with SQL Server SP3).
- The Witness server can be a version of SQL Express and does not need to be a full-blown version of SQL Server.
- The database you want to mirror is in Full recovery mode.
Now, your server don't have to be on the same domain as you can use SQL Certificates; however, you'll find that database mirroring is much easier to setup if all the machines are on the same domain. The first step is to make sure that all of the SQL instances are running underneath the same domain account as opposed to the Local Account. The easiest way to accomplish this is to open up SQL Server Configuration Manager on each SQL instance, click on SQL Server 2005 Services, right click the SQL Server option, choose Properties and on the Log On tab choose "This Account" and enter in the credentials of the domain account you created to run your SQL services. When you are finished, click OK and your SQL services will restart.
Next, on your Principal server, you want to perform a Full database backup on the database you want to mirror. To do this, connect to the Principal server in SQL Server Management Studio, right click on the database, choose Tasks -> Backup, make sure the Backup type is set to "Full" and make sure you choose a Destination with a file extension of .bak. On the Options page, select the "Overwrite all existing backup sets" and then click OK to start the backup process. Once the backup is finished, you will want to connect to the Mirror server and restore the backup by right clicking "Databases", selecting "Restore Database", choosing "From device", clicking the browse button to the right, selecting your backup, checking the checkbox for your database and going back to the top and selecting the name of your database in the "To database" dropdown. Once that is completed, select the Options page, check the "Overwrite the existing database" option and then choose the Recovery state option that has "RESTORE WITH NORECOVERY" at the end and click OK to being the restoring process.
Once the full backup restoring process has been completed, you need to go back to your Principal server and perform a Transaction log backup. To complete this, you will use the same steps as the full backup except that for the "Backup type" you will select "Transaction Log" and then in the Destination box you will first remove the current destination and then Add a destination where you use a filename with a .trn file extension. Once the transaction log backup has been completed, connect to your Mirror server and restore the transaction log. To do this, you will right click on your restored database, choose Tasks -> Restore -> Transaction Log, choose "From file or tape", browse to your .trn backup, select the checkbox for your backup and then on the Options page choose the option with "RESTORE WITH NORECOVERY" at the end.
At this point you are now ready to configure your database mirroring. Connect to your Principal server, right click on the database you would like to mirror, select Tasks -> Mirror and select the "Configure Security" button. This will launch a wizard where you have to specify the names of your Principal, Mirror and Witness servers, connect to all of them and when you get to the "Service Accounts" page, simply click Finish and click Start Mirroring once the wizard has completed. At this point you should have successfully created a quorum and your database should be successfully mirrored and synchronized.
Hopefully, this guide will help you make your databases more redundant and help your organization attain a higher level of availability.
Fixing the "SQL Server replication requires the actual server name to make a connection to the server." Error
Recently, I ran into a whole set of problems setting up a client's SQL 2005 database mirroring solution. I had successfully setup database mirroring numerous times and I couldn't figure out why I was having such a hard time with this instance. I loaded up the Database Mirroring Monitor, tried selecting my Principal server in the mirroring solution and I received the following error -
I was confident that the name I was entering was in fact the current machine name. I decided to run the following query against the master database on the SQL server in question -
To my surprise the name listed didn't match the computer name of the SQL Server! At this point, I realized that this server had a different computer name when SQL was installed and the server had been renamed since then. Fixing this problem isn't a trivial renaming of the SQL instance unfortunately. To fix this issue you need to run the following stored procedures -
GO
sp_addserver 'current_computer_name', 'local'
At this point, if you re-run the SELECT @@SERVERNAME query, you will get a NULL value for the server name even after a restarting of the SQL Service. Just restart the SQLSERVER service and when you re-run the query the new name will now appear.
phpBB3 Mobile Style / Theme
One of my users pointed out to me while phpBB 3 renders fine on mobile browsers with the default template, there's too much pinching and zooming and the such to read a phpBB forum effectively. Therefore, he wondered if there was a style I could implement with some browser detection so that mobile users would have a better phpBB experience. To my surprise, phpBB 3 has no inherent support for mobile browsers and it doesn't seem as if phpBB 4 has any plans on implementing a mobile style/theme/MOD by default. After a lot of searching and some trial and error, I finally found a working solution and wanted to write out that post here so people could follow.
I found phpBB Mobile which was only just recently developed (good timing) less than a month ago. It is a MOD for phpBB that allows for user agent detection so that if one of your normal users browses from their mobile phone, their browser's user agent is detected and a mobile style is used to display your forum. While there is some documentation and a forum dedicated to this MOD, I wanted to add some notes to their documentation.
- Download the phpBB Mobile MOD.
- Extract the archive locally before uploading to your server for easier manipulation.
- Inside the archive open /phpbb_mobile_(version)/install_phpbb_mobile.xml in a browser so that you can read the instructions.
- The first "step" you are presented with is a SQL CREATE TABLE command to create the phpbb_mobile table. Note, if you used a different table prefix for your phpBB 3 install, you need to change the table name in this SQL query (for instance, I used phpbb3_*). Run this SQL command on your database server.
- The next section is a "File Copy". Copy the files from your extracted archive in the /phpbb_mobile_(version)/root/ folder to the root section of your forum installation on the web server.
- The next section is called "Edits". Download the /includes/constants.php and /includes/session.php files from your web server and make the necessary edits locally and then re-upload back to your web server.
- You will be at the "DIY Instructions" section. Log into your Admin Control Panel, Click on the System tab, click on "Administration Control Panel" link on the left side vertical menu, click on Styles, click on Style management, click on Styles, and then in the drop down to the right select phpBB Mobile and click Add module.
- You should now click "Enable" to enable the module.
At this point, the MOD is installed, but still doesn't do anything "useful" for your mobile users. You still need to install your mobile styles and then create the browser rules and associate them with your mobile styles. You might be wondering if anyone has developed any good mobile styles. The best one I found was an iPhone style also made by phpBB Mobile.
- If you need to install a new mobile theme at this point, you must go back to the System -> Admin CP -> Styles -> Style management -> Styles page and Delete the phpBB Mobile MOD. Why? Because, if you go to the Styles tab when this MOD is installed (doesn't matter if Disabled or Enabled), you can't properly install new styles/themes. After this is done, install your mobile style as normal. After you are done installing the style, re-add/re-enable the phpBB Mobile MOD.
- At this point, you need to know what your mobile style's Style ID is. If you go to your database, browse the data in the phpbb_styles table (replace phpbb with whatever prefix you used) and you'll want to take note of the ID for your mobile style.
- In the Admin CP, click on the Styles tab. You will now notice that phpBB Mobile options are displayed right there on the Styles page. Here, you will add the rules for which style is shown for which browser. The way the rules work is that the "Browser" box should include some unique text string found in a specific browser's User Agent and then the ID for the style you want should go into Style box. So, for instance I added the following - "Android", "iPhone", "webOS" all pointing to style "5" which is my mobile style.
That's all you need to do! Now, obviously, with every upgrade you make to the core phpBB installation, you will have to make sure that this MOD doesn't break. Good luck.
How To: Fix Visual Studio 2008 Design View Hang / Not Working
Recently, I had to do some home .Net development (I mainly do .Net work only at ... work), but when I had some Internet issues and had to work offline, I loaded up my copy of Visual Studio 2008. I opened up my web project and everything seemed to be working fine until I tried to switch to design view on any page or control. Once I tried going to Design View, Visual Studio would stop responding and only a forced quit would close the application. Here's the environmental settings I was working with -
- Windows Vista Ultimate 64-bit Edition
- Visual Studio 2008 Service Pack 1
- Microsoft Office 2010 64-bit
Nothing out of the ordinary as you could see. Obviously, whenever I run into a problem like this, I load up a search engine and search for a solution and found quite a few complaints about this problem. However, after reading the "de facto" solution post from Microsoft, I felt as if I needed to more accurately spell out how to fix this problem since I only found the correct solution after reading through several posts.
- Close Visual Studio.
- Open up your Control Panel.
- Go to your installed Programs and Features.
- Look for an entry called Microsoft Visual Studio Web Authoring Component.
- Right click on this entry.
- Choose Change.
- Select the option to Repair.
- Re-open Visual Studio and try using design view in your web application.
Obviously, if you don't have this program, you need to install it. Fixing this problem, for me, was really that simple while other posts talked about editing your registry key for Office LastProduct, making sure you had Visual Studio SP1 installed, etc. However, I found that this was the easiest solution that worked for me.
How To: Setting up Virtualization on Windows Using VMWare Server
One of the greatest strengths of today's computing environments that is completely underutilized by most of the user base around the world is that of virtualization. Virtualization allows you to run multiple "guest" operating systems simultaneously on a single machine. You might ask - "Why is this so groundbreaking?". Virtualization offers numerous advantages over traditional single operating system setups for a lot of reasons, but not limited to the following -
- No longer need to dual, triple or "more" boot your main machine so you can stay in the operating system that is most comfortable to you while allowing you to learn, test and experiment with other operating systems (great way to learn Linux).
- No need to run multiple computers saving on power and equipment costs while also saving on space (only needing one keyboard/mouse, no A/B switch, no KVM needed, etc.)
- Quicker and more efficient restores of system settings and data allowing for more testing of applications, settings, etc.
- Increased flexibility in moving virtual machines from one physical machine to another.
Those are just some of the advantages of setting up a virtual environment. Now that I have convinced you on virtualization merits, how do we get everything setup. My virtualization software of choice is VMWare Server 2.0 which is free to use and allows you to install this software on your current operating system. My computer at home was running Windows Vista Ultimate at the time which made the decision of what virtualization software easy to use as Windows Virtual Server 2008 doesn't support Windows Vista.
Installing VMWare Server 2.0
Here's a pretty easy guide to follow for installing VMWare Server.
Once VMWare Server 2.0 is up and running on your "host" machine, you want to start setting up "guest" machines. In preparation of starting the guest virtual machine process, you want to obtain an ISO of every operating system you want to setup. For me, I get all my Windows ISOs through my MSDN Universal subscription, but you can definitely create Windows ISOs other ways. For Linux distros, you can download those freely from that distro's website. After you have all the operating system ISOs you need, you are ready to create your first guest virtual machine.
Creating a Guest Virtual Machine
For this example, I am going to create a Windows 7 Ultimate guest virtual machine because it's probably the most complicated (and that's not saying much). I followed this guide for creating a Windows 7 virtual machine. You would follow very similar steps for setting up any other VM whether Windows or Linux.
Using Your New Guest VM
I won't rehash too much of what is already spelled out in the above guide; however, there are a few things I want to point out. When you load up the VMWare Web Access Home Page, you may get an authentication prompt and you have no idea what to put in. You will put in the same username and password that you used to log into Windows. After that, you will want to make sure you install VMWare Tools as directed by the guide. This allows for much easier copying and pasting between your host and guest machines. In addition, I have found that VMWare Web Access doesn't work properly in some browsers like Google Chrome so you might be forced to use a browser that you don't normally use like Internet Explorer - especially when trying to launch the console plug-in.
Once you have powered on your guest VM, click on the Console tab in the Web Access page, load the console plug-in viewer and start using your new VM! Good luck to everyone trying to setup virtualization - once you go virtualization, you'll never go back.
StarCraft 2 Beta Open!
Finally, finally, finally. Blizzard has opened the StarCraft 2 Beta! I was lucky enough to win a beta key through Twitter and following the SC2 Team via their updates there. Promptly after the beta opened, I received my email with download instructions and beta key.
The download was 1.64 GBs and went pretty quickly considering I am sure the beta servers were being hammered by downloads from all over. Once the download was complete, you are presented with a well-done installation screen and installation is remarkably painless for a beta product. On my 64-bit system, it defaulted to the Program Files (x86) directory.
Upon setting up your StarCraft 2 user ID, you actually have to pick two names separated by a period which is definitely a little confusing. This is supposed to prevent naming collisions, but I think the entire system is too confusing and could definitely be simplified. After setting up my account, I immediately created a 1v1 game against a computer AI. Currently, the computer AI is locked into "Very Easy" mode which basically means you can build uninterrupted with no aggression from the computer. Immediately, there are some pretty noticeable differences from the original StarCraft - mainly, old buildings have some new key shortcuts and some buildings have new add-on options and research capabilities which I will hopefully address in future, separate posts.
Tech Trees
Currently, the only way to really see the tech trees, since there is no manual, is from within the game itself. Therefore, I decided to use the game's screenshot function to capture the tech trees for each of the races.
One of the biggest omissions from the Zerg tech tree that I noticed is that the Lurker unit has been removed from the beta. The Lurker was a powerful, burrowed attack unit that did range damage to everything in its path in the original StarCraft and I believe was originally in the plans for StarCraft 2, but is currently unavailable.
Original StarCraft vs. StarCraft 2 Beta
Wow, there are so many differences it's almost nothing like the original, but similar enough that outsiders may just see "only new pretty graphics". I will try to address the differences race by race as I find them.
Terran
- Command Center - Mostly the Command Center is the same - builds SUVs, can take off, has a scan add-on just like the original. However, there is an additional add-on that allows for the Command Center to become a powerful defensive turret, but anchors the CC to the ground. This "replaces" the nuclear silo add-on from the original.
- Refinery - no real change from the original.
- Barracks - Almost completely different. The only thing the same from the original is that it can produce marines and that's it. Barracks now have two possible add-ons - one that allows you to produce 2 marines at a time, but you can't build any advanced units and an add-on that allows you to build more advanced units like Reapers and Marauders. There are no medics at the barracks anymore and have been replaced by a Medivac airship.
- Engineering Bay - Mostly the same with your infantry upgrades done here with a few new additions. The biggest mechanic here is the queuing of research which wasn't available in the original.
- Bunkers - Very similar to the original.
- Factory - Similar to the original in purpose; however, the units you can create, outside of the siege tank, are different. However, the same game mechanics apply.
- Ghost Academy - Brand new building from the original. As the name implies, allow for Ghosts and nukes to be built.
- Armory - Very similar to the original.
- Starport - Very similar to the original in terms of game mechanics. The main difference with Starports in SC2 are that all of the ships available, except the Battlecruiser, are different than the original. Medivacs replace ground unit medics and also act as cargo ships as cargo ships have been removed from SC2.
- Fusion Core - A new building specifically used for being able to create Battlecruisers.
Fixing the "The components for the 64-bit debugger are not registered" Error
Recently, on my new 64-bit home development machine, I fired up Visual Studio 2008 for the first time in a while and decided to start cranking out C# solutions to the Project Euler questions. Since I have already completed 14 questions about a year ago, I was able to code a solution to Question #1 very quickly. I decided to debug the solution and ... wham. I received the following error -
The components for the 64-bit debugger are not registered. Please repair your Visual Studio 2008 Remote Debugger installation via 'Add or Remove Programs' in Control Panel.
To resolve this issue, you will need your Visual Studio 2008 installation disk. On this disk, you will find the following path -
Inside this folder should be an executable called "rdbgsetup.exe". Run this EXE, open up Visual Studio and you will now be able to remotely debug your projects.
Fixing "Excel Cannot Connect to SharePoint List" Error
Recently, seemingly at random, our company's SharePoint sites all experienced a serious error when trying to utilize the "Export to Spreadsheet" list functionality. When users would click on "Export to Spreadsheet" everything would seem normal - users would get a prompt asking them to either Open or Save an .iqy file, (assuming you choose Open) Excel would launch, depending on the user's security they would get the macros warning and then ... error. The error reads -
"Excel cannot connect to SharePoint list."
That's pretty much it - no details, no stack trace, no real logging, no event log notification - nothing. With pretty much no information to go on and nothing in our Change Management Log for our SharePoint server farm, I started troubleshooting this issue mainly in the dark. Turning to the search engines, I definitely didn't find much information on this error and even less when taking into account we were running Windows SharePoint Services (WSS) v3. I tried a few of the fixes I found online with no success. At this point I opened up a case using my MSDN incidents and started working with Microsoft. The MSFT tech had me check some of the basic issues such as what authentication type my site was using (Kerberos vs. NTLM), some user permissions, SQL security, etc. However, he finally found the issue when we opened up the web.config file located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI. In this web.config file, there was the following entry -
<add
type="Microsoft.Web.Services2.WebServicesExtension,Microsoft.Web.Services2,Version=2
.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" priority="1" group="0" />
</soapExtensionTypes>
According to the MSFT tech, this entry is due to the fact that at some point Web Services Enhancements (WSE) 2.0 was installed on the server (although, I really have no recollection of this ever occurring - maybe this was done through a patch?). By removing this line from the web.config specified above and performing an iisreset /noforce, I then tried exporting to Excel and the functionality was restored. Hopefully, if you are encountering this article, I can save you a support call to Microsoft.
Drupal Upgraded from Version 5.x to 6.x
Well, after almost no updates for 5 months (although the Hagrin.com Forum has been pretty active), I finally decided to take a look at the blog portion of this site and address it once again. I finally upgraded the core Drupal installation and all the installed modules from version 5 to version 6 - a task that I really didn't want to have to do, but was surprisingly easy. I can't stress this enough - make sure you follow the UPGRADE.txt file's instructions verbatim. The instructions posted on the official Drupal site are actually not as complete as the instructions found in this text file and I avoided a lot of headaches by taking my time and stepping through the steps outlined.
A couple of other suggestions that I would recommend -
- Not only backup the web files directed in the UPGRADE document, but you might as well backup all the core Drupal files while you are at it - it doesn't take much time at all and I found it better to be overly cautious.
- Take a screenshot and/or leave open your module page so that when performing a major upgrade you know which modules you had installed and need to update to their new versions. This information is otherwise lost when you upgrade if you didn't back up your modules folder.
- Expect to be down/in offline mode for at least an hour. Now, how long you are down for will depend on your expertise level and how many non-core modules your site has installed. I would expect that most sites have about 5-10 non-core modules installed and updating and downloading each takes time. You can shorten your downtime with a little prep work - download all the updated module packages in advance, extract them prior to bringing your site offline and this should help speed up the upgrade process.
Now, just think - we all get to do this again when version 7 comes out. Good luck everyone.
Filezilla and Unhiding .htaccess
Here's a quick tip post that will help those doing web development on an Apache web server and cannot see their .htaccess which FTPing. If you use Filezilla as your FTP client, by default, Filezilla may hide the .htaccess file during a remote directory listing. To view the file using the Filezilla FTP client, click on Server and make sure the "Force showing hidden files" option is checked. Your .htaccess file should now be viewable in the remote directory.




