Skip to main content

Posts

Hyper-V and reserving RAM for the host/root/parent partition

After a long process, I finally have a real-world calculation for determining how much RAM to reserve for a Hyper-V host. The question/answer about it is here. But the summary is that Hyper-V loses RAM to the Nonpaged pool (and all of it is "untagged") in addition to the "standard" stuff that Microsoft has documented. Be aware that I write MB/GB here, when I actually mean MiB/GiB. I feel it will be more intuitive to see the notation that Windows (incorrectly) uses. Host Overhead 300 MB for the Hypervisor services 512 MB for the Host OS (This is a recommended amount; you have some wiggle-room with this.) [The amount of physical RAM available to the host OS] multiplied by 0.0425 (result in GB ) for the Nonpaged pool (Which means multiply that by 1024 to convert to "MB") Per-VM Overhead 24 MB for the VM 8 MB for each 1 GB of RAM allocated to the VM. Examples 12 GB RAM, 1 VM @2 GB, 1 VM @4 GB Host: 812 + (0.0425 * 12 * 1024) = 1,334.24 MB...

Live Migration between domains

For those of you like me who aren't experts at all things Active Directory (AD) and Hyper-V Live Migration (LM) permissions, it can be enough of a pain to LM a Virtual Machine (VM) between domains that you simply decide to take the VMs offline to affect the move. See, I only tolerate AD because it's required for LM'ing VMs; there isn't a choice. (It's also required for Windows Clusters, but that's a different topic.) But I figured it out. My back-story is that we setup a cluster using Windows 2012 r1 as the AD Domain Controller (DC) and Hyper-V Server 2012 r1 for the VM hosts. Then we decided we wanted to use r2 for the AD DC and Hyper-V hosts. Upgrading Hyper-V was easy. But I found that there's some unresolved Microsoft bug with Windows Clustering when upgrading the AD DC from Windows 2012 r1 to Windows 2012 r2--- clustering simply doesn't work correctly anymore . So we gave up and created a from-scratch Windows 2012 r2 AD DC then made a new cluster...
In my attempt to deploy ReFS into a Production environment, I did some testing to see what sort of performance hit I should expect. As it turns out, it doesn't look bad, especially considering the benefits I'm after (protection against bit rot). Be aware that what I was most concerned about was the differences between the 3 configurations I looked at. I used 6 physical drives; all 10k HDDs in the same DAS enclosure. 2 were in a hardware RAID-1 array at the DAS level. The next 2 were also in a hardware RAID-1 array at the DAS level. The last 2 were setup as JBOD (Dell's app makes me set them up as a single-disk RAID-0). So Windows sees a total of 4 drives. One of the RAID-1 drives was formatted as NTFS ("raid1, ntfs"). The other RAID-1 drive was formatted as ReFS ("raid1, refs"). The last 2 were added to a "manual" Storage Spaces Pool, then I explicitly created a Storage Spaces mirror from those 2 drives and formatted the resulting volume as...

Excel is my nemesis

Seriously, when is Microsoft going to make a setting that says, "Do NOT auto-detect data types!" so I can check that box? I deal with raw data a lot, and we end up using CSV simply because most everyone has a program that allows for easy viewing of the data inside (I still wish people had settled on a simple delimited format, but that's another rant). Excel (2007/2010) ends up being the most common data-viewing-tool that people use.  It's unfortunate. Most people have no idea that Excel attempts to auto-detect the type of data in a field, and even less know that some of it's guesses are irreversible. So if you send them a csv and they wish to change one little thing before sending it along, they have no idea that they just screwed up the file! Date information is the most annoying. If you send "yyyy-MM-dd HH:mm:ss", it gets transformed into "M/d/yyyy HH:mm"---not only for viewing, but it gets saved back into the CSV in that format! So st...

Caesura 1.0

About a year ago, I made my first application for Android (1.6; Donut). This post is mainly to give me an easy way to install it again now that I've upgraded my G1 to CyanogenMod 6.1.0 (Android 2.2; Froyo). The purpose of the app is to restore the volume/ringer after turning it on Vibrate/Silent. Whenever you turn the volume down to Vibrate/Silent, the app pops up a menu that has 4 configurable options plus a "restore to this volume" slider. If you long-press an option, you can change it to be something else. You can either make the volume restore after a set amount of time (e.g 4 hours), or at a particular time (e.g. 8:00 AM). I use it each night before going to bed, or when I'm going to a meeting.

SSRS 2008 - Getting the schedule of a subscription on a report

After wasting a few hours, I've decided it's not worth it to proceed any further. If you want to know the schedule (or just the next-run-time) of a subscription, just go to the SSRS web site (the web UI). It's too much of a pain to use the ReportingService2005 interface. The simple back-story to this is that I've made an app that handles uploading (create/update) all of our reports (.RDL files) from the local computer to an SSRS instance. Doing this through the web UI is incredibly tedious, error-prone, and my Carpal Tunnel flares up after a few reports. So now that I'm done, I decided that it would be nice to see information about all of the various subscriptions that people have defined for the various reports. It's not hard to add this in. You just call ListSubscriptions(null, null) after logging in with an admin account. But the Subscription object has no information about the schedule it runs against! Well, actually it can tell you a few things via the...

Disappearing exceptions (x64)

Hopefully, this will help me the next time I bang my head against the wall trying to figure out why an application of mine is going crazy, but none of my error-handling code seems to be working. The core threads that explain this are here: Visual Studio doesn't break on unhandled exception with windows 64-bit The case of the disappearing OnLoad exception   Silent exceptions on x64 development machines (Microsoft Connect) The summary is this: If an exception is thrown on Windows x64 (Vista, Win2k3, Win2k8, Win7, etc.) and it hits a kernal-mode boundary, it will be dropped. Execution will continue at that point as if no exception had been thrown. The simplest example is to create a new WinForm application and simply throw an exception from the OnLoad event. Not only will VS2008 not stop execution on that exception during debugging, but if you run it in "Release" mode, there will also be no trace of the exception. In this case, your code (OnLoad) was ultimately ca...

SqlBulkCopy and the "colid" error

I thought there was a page explaining this somewhere out there on the Internet, but I can't find it anymore. So here's what I re-discovered. When you try to insert the rows from a DataTable and the data in one of the columns of one of the rows is too big to fit into the destination column in the database, you get a SqlException with this error message: "Received an invalid column length from the bcp client for colid N." (Where "N" is a number.) It doesn't tell you which row, and it's a pain to figure out what column to look at. To determine what column it is referring to, you first need to get a listing of all columns in the table, listed in the order as they have been defined in the database. Next, you remove any columns in the list that are not represented in SqlBulkCopy.ColumnMappings (the order of the column mappings is irrelevant). The list that remains is what "colid" is referring to, with the first column corresponding to colid ...

Outlook 2007/2010 Search Folders using email address domain

As of May 2010, the Beta of Outlook 2010 still hasn’t overcome this problem. I’m surprised this glaring omission has been left unfixed. Maybe Outlook is maintained by contractors? I have what I consider to be a simple need. I want a “Search Folder” that shows me all the email related to a particular client. What works well for me is a query that finds any email with the client name in the subject, or any email that involves an email address (from/to/cc) from the client's email domain. Back in Thunderbird, it was simple to setup a rule for this. Outlook can't do it. (I'd go back to Thunderbird, but I have to get calendaring working first.) What doesn't work When you edit the criteria for a Search Folder, on the “Messages” tab, the fields you want appear to be represented, but the way things work is wrong. All the criteria specified must be true, not any; they went with “AND” where I need “OR”. The other problem is that the “From…” and “Sent To…” fields use a “starts-with...

Because Yes/No isn't good enough

I personally don't believe that Vista/Windows 7's UAC is "enough" for the default setup. You know: the one where there's a single user account on the computer, and maybe the owner bothered to set a password. See, I think UAC is awesome; no software gets free license to do whatever it wants without the user saying OK first. (We only had the "I hate Vista's UAC" stupidity because no software developers bothered to follow Microsoft's guidelines up until that point and took the "everyone's an admin" easy-way-out.) The problem is that most people will still setup their user account as an admin, and the UAC dialog only asks a Yes/No question for administrators. It's the same problem we've had for years. What's the average user going to answer when they're trying to do something (watch a funny video, enter a site a friend told them about, etc.), and something else bugs them with a "You can't continue to do what you...

Stupid-Virus 2010

I don't know what exploit just hit, but I have now just finished my 3rd removal attempt of "Internet Security 2010" (aka "AntiVirus 2010", and all the other versions of this virus). I've never seen such a successful attack---but then again, these were all old XP machines. Anyhow, I think I finally have it down now, and I'm writing this to remind myself for next time. Get MalwareBytes Get ProcessExplorer, AutoRuns, and that command-line utility that schedules file renames during Windows' startup. Go to BleepingComputer for their guide, but also their .reg file Put it all on a USB stick So the virus sets a bunch of registry settings so that you can't use Task Manager, change the desktop wallpaper, and a bunch of other annoying things. It also makes it so one of its processes gets loaded in each time you launch an exe---so it has a chance to deny access to it and pretend it's infected. Since MalwareBytes will take care of most of it, use Process...

MailAddress can't eat its own dogfood

Just found out today that System.Net.Mail.MailAddress (.Net 2.x/3.x) can't "eat its own dog food"; very frustrating. Previously I decided that rather than waste my time trying to come up with a good email address validation routine, I'd use the one in MailAddress's constructor. (It has to go through there at some point anyhow.) I thought I got the additional bonus that it would actually normalize/fix some addresses it considered valid/OK/good enough. Unfortunately, I later found out that the constructor doesn't always like what it (itself) changes the address to. MailAddress ma = new MailAddress("x y@z.com"); // ma.Address is "\"x y\"@z.com" at this point... ma = new MailAddress(ma.Address); // this will throw an exception. Now my validation routine has to send it through twice. This is to make sure that I never have to worry if subsequent code uses the "Address" value instead of the original.

Reclaiming disk space in Vista

Normally, I expect my drive to be rather bloated from all the iso files I keep around, but on occasion I try to clean things out. My latest attempt came from a desire to fit everything in under 80GB so I can buy an SSD (I was at 110GB). This laptop is running Vista x64 Business, SP2 with 3GB RAM. WinDirStat I always start by looking at the disk space usage. I previously used TreeSize, but now I use WinDirStat ; free and I prefer it now. I ran it as Administrator (so the counts were as accurate as possible) to see where all the space was going. I first used the Windows Disk Cleanup utility (though I skipped the Recycle Bin), but after that, most of the good information came from " Where's all my disk space going in Vista? ". Volume Shadow Copies This ended up commanding the largest space, and you can only "see" it as an Administrator since the files are in c:\System Volume Information . This page has good information about it: " Adjusting the amount of disk...

"Content-Encoding: gzip" failure for IE

Oh boy. I became aware of another crippling bug with Internet Explorer today (IE6, IE7, & IE8). In short, when downloading a .zip file that is transmitted using gzip encoding, IE doesn't unpack it before passing it on to the end-user. So instead of getting a .zip file as expected, you get a gzip file that contains the file you wanted to download. To the average client, it appears that the file is corrupted---and in the end, that's all that matters. Based on the various discussions found when Google-searching for "gzip ie7", it appears the problem is (at least) in the Vista versions of IE. I happen to be on Vista x64 SP2 and IE8, so that's at least one environment where the bug is present. The server is irrelevant, but if you must know, I'm using IIS 6 (Windows 2003 Server) with .Net 2.0; the page's extension is ".aspx", but I use the content-disposition header to give the download a ".zip" extension. There is this one page where so...

IE7 and no-cache HTTP headers

If you ever want to make it so IE7 will not download a file, set the Cache-Control or Pragma headers to "no-cache". Some time in the past, I thought I learned that when you want to stop a proxy server from caching a file (apart from or in addition to the actual client), you set the following headers: "Cache-Control: no-cache" and "Pragma: no-cache". In C# ASP, that equates to the lines Response.Cache.SetCacheability(HttpCacheability.NoCache); and Response.AppendHeader("Pragma", "no-cache"); (I believe the Response.Cache.SetMaxAge(TimeSpan.Zero); line was also suggested to me as part of this, but I can't remember anymore.) If you send either of those 2 headers, you'll get a completely useless error message from IE7 when clicking a link to the page---you'll see "Internet Explorer cannot download filename from domain/server ... Internet Explorer was not able to open this Internet site. The requested site is either ...

Finally! A bluetooth headset that works with both phones!

After what seems like ages, I finally have a headset that works with both my cordless and my cell phone! I've got an AT&T EP5632 and a Motorola Krzr K1 (T-mobile), and all I want to do is have a single headset that I can use with both phones simultaneously. I have that now with the BlueAnt Z9i . The EP5632 has been hit-and-miss concerning with what it will connect/pair. Unfortunately, the only compatibility list is on AT&T's site , and it's severely lacking. To add to the mess, I can't find enough documentation to figure out specifically what it's not compatible with. The best info I've found simply says it can handle Bluetooth 2.0 with both headset and hands-free profiles; In practice, that's not enough info. Here's what I've gone through: Plantronics Voyager 510 - YES. Multipoint. Works with both, but not simultaneous (if on one call, cannot switch to other phone to answer). It was was starting to fail on me about the time of the purc...

Filling out a PDF form with iTextSharp

I needed to make an aspx page that would allow me to pull a PDF from disk, fill out fields in it, then stream the completed PDF to a browser. After searching around, I found that the consensus seems to be that iTextSharp is the way to go in C#. I grabbed version 4.1.2. While the iText API docs are useful, it's hard to start out with that. I found that this example proved the most informative and useful of those that popped up on Google. However, even with that, I found that only the source code really answered all of my questions. Extra things I found noteworthy: All of the PdfReader constructors ultimately use the RandomAccessFileOrArray object to access the source PDF data. The PdfReader(RandomAccessFileOrArray...) constructor results in a partial read ( ReadPdfPartial() ), whereas all the others read & parse the entire PDF ( ReadPdf() ) during construction. It appears, from this post , that the former uses less RAM, but the other constructors result in faster performanc...

UPDATE...FROM (Sql Server 2005/2008)

I keep forgetting how this concept works each time I go to do it. I always start off with a simple update , then find I need a quick join to another table to use a value there to complete the update. What I forget is how the table referenced after UPDATE relates to the tables/columns in the FROM (and SET) areas. From what I understand now, the "x" in "UPDATE x" either directly matches a table referenced in the FROM clause, or directly matches an alias for a table in the FROM. In the example below, there are 3 updates that are functionally equivalent. CREATE TABLE #table1 (t1_pk int, t1_months smallint); CREATE TABLE #table2 (t2_pk int, t2_t1_pk int, t2_starts datetime, t2_ends datetime); INSERT INTO #table1 VALUES (1, 2); INSERT INTO #table1 VALUES (2, 5); INSERT INTO #table2 VALUES (1, 1, '2000-01-01 11:45 PM', NULL); INSERT INTO #table2 VALUES (2, 1, '2001-01-01 02:50 AM', NULL); INSERT INTO #table2 VALUES (3, 2, '2004-01-04 06:45 PM', NUL...