Recently in über-geek Category

Import PDF into Visio 2007

| No Comments

I had a need to import some CAD drawings into my Visio document. The CAD drawings were provided to me as PDF documents. Visio has no native way to insert a PDF into a drawing. SnagIt to the rescue. Besides being an excellent app for making screenshots, it installs itself as a printer. Well, all I did was print my PDF to the SnagIt printer, saved the image as a TIFF, and then inserted the TIFF into my Visio drawing.

The resolution was quite good and I achieved exactly what I wanted. Gotta love it when shits works out!

Enhanced by Zemanta

SqlCeReplication PublisherSecurityMode

| No Comments

I've been toying around with SQL Server CE replication. For whatever reason, my code was failing with the following exception when I called Synchronize():

Failure to connect to sql server with provided connection information. sql server does not exist, access is denied because the iis user is not a valid user on the sql server, or the password is incorrect.

As it turns out, if you use the follow form of the SqlCeReplication ctor (as observed using Reflector):

public SqlCeReplication(string internetUrl, string internetLogin, string internetPassword, string publisher, string publisherDatabase, string publication, string subscriber, string subscriberConnectionString)

the PublisherSecurityMode is set to SecurityType.NTAuthentication. Otherwise, if you use the parameterless ctor, PublisherSecurityMode is left to its default, which is SecurityType.DBAuthentication. This assignment is NOT documented.

I am working on a SQL Server 2005 Reporting Services (SSRS) report that has differing row colors based on a value in each data row.  The color value is defined in the database.  When I initially created the report, each row had a variable background color but the foreground color was black.  The first time I ran the report, my dark blue background didn't contrast well with my black foreground.  I quickly realized that I needed a way to vary the foreground color programmatically based on the background color.  After first discussing things over with Nate, here is the expression I came up with for the Color property of the table row:


=IIF(
((
((CInt(Fields!Status_Color.Value) And &HFF) * 299) +
((CInt(Fields!Status_Color.Value) >> 8 And &HFF) * 587) +
((CInt(Fields!Status_Color.Value) >> 16) * 114)
) / 1000) < 125,
"White",
"Black"
)


Let me explain where this all comes from.  First off, the color that is stored in the database is used by a VB6 program.  VB6 stores colors as BGR and .NET stores colors as RGB (well, technically aRGB).  The first step is to break down the value from the database to its constituent parts (red, green, and blue) using bitshift operations I learned from Keith Peters and then apply the contrast formula I found from Colin Lieberman's website. I then determine that if the blackground is a dark color, then we use white and for a light background, black.  This appears to working like a charm.

Request Tracker RT_SiteConfig.pm

| No Comments

Don't forget when you update the RT_SiteConfig.pm file, you need to restart httpd. I was banging my head against the wall of this one until I had a moment of clarity.

Last night we purchase an Apple TV (as well as a Mac Mini, 20" Cinema Display Monitor, wired keyboard, and wireless mouse). Today I had the unfortunate happenstance of making this little gem of a unit find, and talk to iTunes running on my Mac Pro. I'll save you the gory details buy my switch is a Linksys SRW224G4P and in the end, I had to disable IGMP Snooping. Otherwise the multicast traffic wasn't flowing around correctly. This fix came as "well, let's just see if we turn the helper off". Well sure as shit, it worked. Yippee for me!

Apple Mac Time Machine and iSCSI

| No Comments

I wanted to report that I succeeded in using iSCSI (on an Openfiler server) with Time Machine via a gigabit link with jumbo frames (MTU of 9000) enabled. The secret to my success? I used the iSCSI initiator from http://www.small-tree.com/. It appears as if the iSCSI initiator from globalSAN is just a plain broke down piece of shit. Well, you do get what you pay for. Hurray for me and my buddy Steve over at Small Tree!

Ok, I first have to say how blown away I am that I was able to get this to work. Here's the scenario. I was unsuccessful in having VMWare Fusion run my Vista x64 Boot Camp partition (probably for this reason). After many fits and starts, the plan was to create a Vista Complete PC Restore image to an external drive. Then create a VMWare Fusion Vista x64 VM and restore the backup to the VM. The first thing I learned is that Complete PC Restore must restore the image to a drive that is as large (or larger) than the original drive. This is apparently because the backup is a true disk image and not a file backup. Well, this posed a small waste of time because I had created a pre-allocated 250GB vmdk that now had to be scrapped for a 500GB dynamic volume. Also, during the restore, I received an error. I attempted the restore a second time without checking the box to format the drive, and this time time it took.

After a night-long restore of the image, I came into my office in the morning to find the VM repeatedly rebooting do to a Vista blue screen and Vista set to automatically reboot after a stop. I left the VM in a suspended state and went to work. Later on in the evening, I set out to fix the problem. The problem was a 7B stop, which means that a hardware driver for the mass storage unit was not loading at boot. Well, sure, I now have a new IDE controller; as far as Vista is concerned.

Ah, but this is where is gets slick. Vista is now equipped with a revised recovery console, or WinRE. The long and short of it was that I was able to edit the registry from the recovery console. Yes, phat, I know! The docs on how to do this at MS are missing a step (they fail to mention that you need to edit within the "offline" key), so I was able to find better docs elsewhere. This combined with the information as to what registry keys to edit from MS, I was in business. As for that last page from MS, all I did was change the Start value on the two drivers from 4 to 0.

w00t!

Add/Remove Windows Feature Error

| No Comments

I run an XP virtual machine because our ERP app does not run on Vista Business (or any version of Vista). I also use this environment for development work in and around our ERP application. So, today I was installing SQL Server 2005 Express Edition with Advanced Services. Since this includes Reporting Services, I need IIS installed. This is where I ran into trouble. Add/Remove Windows Components would not launch.

When I attempted to launch Add/Remove Windows Components, I received the following error:

Setup library setupqry.dll could not be loaded, or function IndexSrv could not be found.


Contact your system administrator. The specific error code is 0x7e.

The first step in diagnosing this problem was to run Procmon. I saw nothing unusual because all access to setupqry.dll (c:\Windows\System32\Setupqry.dll) was successful. The next step was to use Dependency Walker. Using Procmon, I was able to see the process that reads setupqry.dll, and the command line is:

"C:\WINDOWS\system32\sysocmgr.exe" /y /i:C:\WINDOWS\system32\sysoc.inf

I used Dependency Walker to profile sysocmgr.exe, and sure enough, as part of the log output was:

LoadLibraryExW("C:\WINDOWS\system32\Setup\setupqry.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: %1 is not a valid Win32 application (193).

Looks as if the file is corrupt. I went to another XP workstation here in the office, and copied Setupqry.DLL from their machine. When I went to copy the file to my machine, I immediately noticed that in Windows Explorer, the file lacked a description like the other DLLs. Well, I copied over the existing file, and Add/Remove Windows Components opened up like a charm. Crisis avoided; back to DEFCON 2.

TeleNav and my New 8800

| No Comments

As a follow up to my prior post about my new Teletype Bluetooth GPS Receiver, I found that the having the two devices was way too difficult to manage. Well, that coupled with my need for the latest and greatest BlackBerry, I now have a T-Mobile 8800 with built-in GPS receiver. The software stays the same however there is no longer a need for the brick (granted a small brick) on the dash.

:)

My First Powershell Script

| No Comments

I wrote my first useful Powershell script today. I had a directory of bitmaps and I wanted to convert them to PNG. This is a relatively easy task in .NET. All I had to do was figure out how to do this within Powershell. The script is as such:


foreach($file in Get-ChildItem *.BMP)
{
echo $file.Name
$image = [System.Drawing.Image]::FromFile($file)
$image.Save($file.ToString().Replace("BMP","png"), [System.Drawing.Imaging.ImageFormat]::Png)
}

As simple as this may seem, it really isn't. First, the FromFile() method kept throwing an exception with NO description. After running FileMon did I see that it was looking in the wrong place for the file. As to why it didn't bubble up a FileNotFoundException, I haven't a clue (thanks Redmond). I also attempted to trap the exception, but seems to do nothing as well.

The second hurdle to get past was the fact that Get-ChildItem returns a System.IO.FileInfo type and the Name property contains only that -- no full path. However ToString() does, and so that is where I called Replace() on. Once the pieces where in place, it worked like a charm.

Powered by Movable Type 5.01

Twitter Updates

    Follow me on Twitter

    About this Archive

    This page is an archive of recent entries in the über-geek category.

    Daily Observation is the next category.

    Find recent content on the main index or look in the archives to find all content.