Bizarre Font Distortion When Generating PDFs

This was a very strange issue, so the title of this post is equally strange.  I don’t really expect anyone else to ever see this problem, but just in case…

We use an older application to generate catalogs where I work, and there has been a long-standing issue that has come up from time to time for particular users (since before I even started there).  The problem was that specific users would find that the font did not render correctly when generating the PDF version of the catalog.  This was a non-standard font that was used, which had to be installed, but the font was installed correctly for these users (this was over remote desktop on one computer, and it worked for all other users).

Everything was the same for this user until the PDF was generated.  It was hard to describe (basically the letters seemed squished together), but the font was clearly not the same when compared to a correct version.  To make sure it wasn’t just a display issue, it would be saved to be viewed on another computer, but it looked incorrect wherever else it was opened.  The temporary solution for this user was to run the application locally, which seemed to work.  Each time the problem came up again, I would spend some time troubleshooting, and I thought I got close with an Adobe Reader plugin for MS Word that seemed related, but I always came up short.

Fast forward 3 years later, and another instance of the issue arose, and I spent a little more time troubleshooting.  I can’t remember what I did to cause the error, but playing around with things led me to a message about some “ActiveReports” VB6 control.  Not having anything else to go on, and thinking that anything saying “reports” might be related to generating this PDF, I started Googling.

I managed to come across this post:  This page described my issue exactly, and even had example screenshots to prove it!  That post pointed me to another forum:  It suggested changing the computer’s (local computer, not the computer being connected to) screen resolution, which seemed strange, but I gave it a shot.

It actually worked!  I found that certain aspect ratios caused this problem.  For whatever reason, this control generated the PDFs and distorted fonts if run over RDP with a widescreen monitor (or at least having that aspect ratio for screen resolution).

So, in case anyone else out there ever sees distorted PDFs generated by some application they run over RDP, or any other bizarre font distortions, it might be worth checking out your screen resolution and aspect ratio.

BackupExec CPS 2010 Snapshot Scheduling

A while ago, I set up BackupExec Continuous Protection Service 2010 (I’d get a direct link to CPS, but I can never find a product page for it). To give a short summation, it provides quicker backups to disk than Symantec’s BackupExec. If you’ve used Microsoft DPM, it’s somewhat similar. You can have schedules such as hourly restore points of servers, or even “continuous” protection, which pulls changes to files on a server as they happen. The important aspect of this software that is relevant to this article, is that CPS pulls files from the various remote servers onto local disk, and, in order to gain retention points, it uses shadow copies. These shadow copies are done with built-in Windows VSS, and are scheduled separately from the backups.

Now to the issue that I had to resolve, and could not find much help in searching online (even my question on ServerFault came up empty). After configuring these snapshots to run regularly, lets call it hourly, I noticed that they were never kicked off. I verified the schedule several times, but they never ran when they were supposed to. I was able to manually run the snapshots (through the CPS console), so it appeared as though the snapshot system was working, but scheduling was not. I dug in deeper, and found that CPS relied on creating Windows Scheduled Tasks to perform these. I looked in Scheduled Tasks, and I didn’t find anything.

I dug through the event log, and anything else I could think of, and I finally realized that I could not create my own scheduled tasks (I got an Access Denied error!). I looked at it from a Windows UAC angle (this was Server 2008 R2), but that didn’t seem to be it. I finally checked the permissions on the folder where tasks are stored (%windir%\Tasks), and here was where I found my problem. Write permissions were stripped from this folder. I later found out this was due to some preventative security measures . After restoring write access, CPS created the job successfully, and I was up and running.

New Site!

So I finally gave in with working on my own blogging site, and went with an install of WordPress.  I also moved off of my trusty home server onto a Linode VPS, to make it seem even more legit.  So far I have liked the ease of use for posting articles, so we’ll see if this manages to make me put up more content.

I’ve also left my old site up for now while I decide how to integrate the rest of the miscellaneous pages I had.

Remember The Milk Time Management

If you’re a system administrator, chances are you’re always pressed for time. Between supporting end users, working on new projects, and just maintaining all those systems you administrate, it’s hard to find the time to get everything done. I know I’ve found time management to be a difficult thing to tackle, but there’s a book I’ve read that addresses our particular situation. Time Management for System Administrators by Tom Limoncelli is a great read for anyone who either needs help organizing their time, or could use some original and effective strategies for our line of work. It says “for System Administrators,” but it is a great “getting things done” book for anyone who has a high volume of things to do and a lot of interruptions that create new tasks.

In the book, Limoncelli puts forth a method (called “The Cycle”) to tackle day-to-day tasks in a logical way that maintains task priority, even while being bombarded with more things to do. I have taken this system and modified it to fit my own needs. I have been using Remember the Milk (RTM) as a way to implement the system, and I have found it to work perfectly with this method.

For this system, you’ll need a single list to store everything you have to work on. This can eventually be more than one list, such as one for personal, one for work, etc., but you’ll want to group large portions of tasks together. To start, enter all of the things you don’t want to forget about, but don’t plan on actively working on in the immediate future. Enter these with no due date, and you can classify them further by priority if you desire. Next, enter future due dates for any tasks that need to be set aside for a later date (such as following up with a vendor after a week). Finally, enter a due date of today for everything else. I should note that even though you’re setting this due date of today, that does not necessarily mean you will be working on those tasks today.

For everything that you set due today, you’ll need to assign priorities because these tasks will be your list of things that follow you day-to-day until they can be completed. Limoncelli’s system uses A, B, and C, which corresponds perfectly to Remember the Milk (1, 2, 3). Priority 1 (P1) should be everything you actually plan to do today. Plan this seriously with how much you know you can do, and mark fewer tasks than what you think you’ll actually accomplish. Priority 2 (P2) is everything that you need to do tomorrow. You will change these to P1 tomorrow when you are planning out your day. Priority 3 (P3) should be for everything else. At this point, you’re all set to begin the daily process of using this system.

According to the system, your day’s work will come from all P1 tasks due today. If you happen to finish those, you can move on to the next priority (tomorrow’s work), although this is not expected. The following day, your tasks jump up a priority, and you have what you’re working on that day. As you’re interrupted during the day, you can quickly throw the tasks into P3 for today (for example, “Fix Susan’s e-mail configuration today !3”), or at a higher priority as needed. The key to the system is to document new tasks that come up, but forget about them until it’s actually time to do them. The less brain power you waste on keeping track of things, the more you can spend on actual work.

An added bonus you’ll get from RTM is the search list. You can create a search for your daily tasks by searching your main list for everything P1 that’s due today. After prepping for the day, you can switch to this search list so you can actually finish everything on your to-do list for the day! It’s very disheartening to look at your list of hundreds of things to do, with no hope of ever emptying it (if you did empty it, you might not have a job :)). This search list lets you complete everything on the list, and actually feel accomplished.

There are several other bonus features that are extremely convenient. One feature is time estimates. By filling this in for your tasks, your search list will give a nice total time estimate of how much work you have left for the day. You also will benefit from repeating tasks. Have to swap a tape every Monday? A P1 task due every week on Mondays will make sure it’s always in your daily list when it’s necessary. Finally, you can have a great repository for all of your completed tasks with RTM. It’s great for job reviews, since you can see everything you’ve worked on over the year in one convenient location!

This system has definitely increased my productivity, and has helped me make sure nothing falls through the cracks. Plus, it keeps me motivated by fighting back constant interruptions and letting me see the end of a list to know I accomplished something!

Excel VBA Macro to Execute a Stored Procedure

The other day I came across a problem of running an MS SQL 2005 stored procedure in an Excel VBA macro. I had set this up before with another stored proc, which worked just fine. Copying this code (and later trying several other ways of doing it) always ended up with a closed recordset being returned. My exact error was a run-time error 3704 with the message “Operation is not allowed when the object is closed.” The code looked something like this:

‘ Create new recordset object
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

‘ Get data to populate spreadsheet
‘ Assign the Connection object.
rs.ActiveConnection = cn

rs.Open “exec database.dbo.storedProcName”, , adOpenDynamic, adLockPessimistic

‘ The error came up here
Application.Workbooks(“Spreadsheet.xls”).Worksheets(“InvAdj”).Range(“A2”).CopyFromRecordset rs
‘ Clean up
Set rs = Nothing

There didn’t seem to be anything wrong with the proc, which ran fine in the management studio, and the VBA code was identical to what I had used in another macro to do the exact same thing (just return data). A lot of Googling didn’t turn up much, but it sort of led me to believe it had something to do with the temp tables used in it. Going off of this, I finally found my problem. The proc was returning multiple recordsets, and the first one I get back after the .Open was empty. I needed to add the following after the open:

Set rs = rs.NextRecordset()
Set rs = rs.NextRecordset()
Set rs = rs.NextRecordset()

Although ugly, this got me through the other recordsets I got back and let me get to the data I needed. My hope is that I can get this p
ost crawled enough to show up sooner in some other poor soul’s searches for this same problem.

“Networking is not installed or properly configured” Error

I came across a strange Windows XP networking issue today, and the magic of Google led me towards the right answer.  The computer could not connect to anything on the network, and I noticed that I was not able to join it to an Active Directory domain.  I saw an error message there that said “Networking is not installed or properly configured.”

I found this post describing the same issues I was experiencing:  Using this information, I discovered that I could just restart the “Server” service (and making sure it is set to automatic) fixed the issue.  I added this comment to the page on which I found a possible solution (which worked, but was a little more complicated), and others seem to have been able to solve this problem the same way as well.

It just goes to show how useful it is to post solutions to problems online when you don’t find the exact answer right away.

Sending a plain string to a MS Message Queue in SSIS

When dealing with an application that will remain nameless, I needed to use SQL Server Integration Services to generate some data, and then put a string into a MSMQ.  While trying to get it to work, I went through the MSDN forums; the thread is here.  You can follow it along there, but the basic solution is to add “MessageQueueTransactionType.Single” as the transaction type parameter when sending the Message to the MessageQueue.

For reference, here’s my code that worked, but didn’t put anything in the queue until I added that transaction type parameter:

Public Sub Main()
        Dim queueMessage As Message
        Dim theQueue As MessageQueue
        Dim messageStream As IO.StreamWriter

            theQueue = New MessageQueue(".\private$\queuename")
            MsgBox("set up queue - " + Err.Description)
            Dts.TaskResult() = Dts.Results.Failure
            Exit Sub
        End Try

            messageStream = New IO.StreamWriter(New IO.MemoryStream)

            queueMessage = New Message()
            queueMessage.BodyStream = messageStream.BaseStream
            MsgBox("set up message - " + Err.Description)
            Dts.TaskResult() = Dts.Results.Failure
            Exit Sub
        End Try

            MsgBox("send message - " + Err.Description)
            Dts.TaskResult() = Dts.Results.Failure
            Exit Sub
        End Try

        Dts.TaskResult() = Dts.Results.Success

    End Sub

AJAX and PHP WebMail Clients (and other ramblings about apt-get dist-upgrade)

There was recently an article I saw online (Slashdot or Lifehacker, I can’t remember) about 10 AJAX and PHP webmail clients. The article is here. I check them all out one night and I ended up liking RoundCube the best. Since I started trying out IlohaMail for a webmail client with my IMAP server, which was very plain and not very user-friendly at the time, I figured it would be a good opportunity to give it a try.

I installed it on my laptop, just to test it out, and it worked great. I immediately brought it to my server to set up and start using. There is a good installer built-in to help with any initial configuring, but it’s only really 2 config files and some permission setting, so I just copied it over from my laptop and edited the configs. Unfortunately, I found that it uses a command (mb_check_encoding) that requires a higher version of PHP than what I was running. Since I update every night, I found out that my installation of Ubuntu Dapper was getting pretty old. I figured this would be as good a time as any to upgrade…

I ended up upgrading from Ubuntu Dapper to Ubuntu Hardy, which led to problems with php5-mysqli (it became a part of php5-mysql, but I hadn’t done a complete upgrade yet). After I finally got everything settled, I attempted a reboot to get the new kernel. Of course, this led to more problems with Evms. My /etc/fstab was changed to include those stupid “UUID” entries instead of the actual devices (ie, /dev/hda1). After booting into the old kernel, editing the fstab, and removing evms (I noticed the problem originally because it spit out a kernel message like “dm-linear device lookup failed” every half a second), I was back in business. Plus, as a nice bonus, IVTV is now built in to the kernel, so I don’t have to worry about adding it as a module anymore.

So, to get back to my original topic, RoundCube is a very nice webmail client, which I found out when writing this uses IlohaMail code for handling IMAP. It uses AJAX in a way that makes it easier to use the application, but doesn’t go overboard. It very simply handles your IMAP mail and folders, and has an additional address book. It’s perfect for getting to your e-mail quickly when you’re at someone else’s computer.

Installing Google Gears on Ubuntu 64-bit

As an avid user of Remember the Milk, I recently noticed that my offline support wasn’t installed on my Linux laptop (Ubuntu 8.04, 64-bit). I went to install Google Gears for this, but realized that it was only available for 32-bit at the time. A little bit of Googling and I found this site. This guy put together the .xpi files for a patched version, which I have found to work completely normally.

Just in case it becomes unavailable at that site, here is the latest version I downloaded from there. Note that he says it is current as of February 2, 2009, so it could become outdated pretty soon, but at least it’s here until there is an official version out for 64-bit.

How to Use BGP++ for Simulations

Below is an old, partially complete tutorial I had up on my old site. If I ever get around to it, I’ll update this with the rest of the tutorial.

Installing BGP++

The first step in doing some network simulations is to actually build and install the simulator. I chose to use a very common one called ns2. In order to do simulations of BGP, you’ll need a patch called BGP++. BGP++ is basically a port of a program called Zebra, and is placed inside the ns2 code so that it can do BGP simulations. With that out of the way, you’ll want to start downloading the source code. You can get the BGP++ code from here, and the ns2 code from here. You should be careful to make sure that the version of the patch is intended for the version of ns2 that you download.

However, instead of downloading the code from the sites, which is very old by now, you may want to consider downloading my set of the code. I have already gone through and made several changes to fix various compiling errors. Inside of the tarball, you’ll find errorCorrections.txt that explains some of the fixes. You’ll need to make sure that you have gcc-3.3 and gcc-4.1 installed, as both were needed during the compiling. You will only need to execute the “install” script with `./install`, but there is a good chance you’ll come across some errors, which you’ll have to figure out what to fix. With any luck, this will only be with dependency issues because I have already gone through most of the current problems. Note that my set of the code has been run as of April 9, 2008, so the longer it has been since then, the better the chances of issues developing. Feel free to send me an email if you have questions, and I can try to help you out some.