Category Archives: Utilities

SED and AWK for the VB Guy

2
Filed under Utilities

Generally speaking, when I need to do a little file manipulation, I usually fire up .net, whip up a little VB.net command line app to do the trick and off I go.

However, a few nights ago, I needed to do some manipulation on a largish (30+meg) xml file. The manipulation itself was fairly simple:

  1. Find a tag in the file
  2. Insert the contents of other files into the target file, right before the tag

However, it was late, and I was feeling a bit lazy, so I googled it.

What I got was almost all the first page results pointing me to SED or AWK.

What’s that?

SED is short of Stream EDitor. Essentially, it’s an app for running a text file through a set of regular expressions and outputting the results.

AWK is short for Aho, Weinberger and Kernighan, the names of the three programmers who originally came up with it. It’s actually a language for processing text. But, any more, it generally refers to the command line application to applying that language to a input file and generating output from it.

Not big on UNIX

Now, I’ve been around long enough to know what SED and AWK are, but I’ve really never actually used them. However, with all these search results pointing that direction, I had to poke around a little more.

You can grab a version of SED for Windows here:

http://gnuwin32.sourceforge.net/packages/sed.htm

And AWK (or GAWK, the gnu version of AWK, get it<g> ) here:

http://gnuwin32.sourceforge.net/packages/gawk.htm

Those pages have tons of excellent resources, as well as examples, all the docs you’d ever want to read, etc.

And these two apps have been around for so long, that, well, a quick Google search will turn up an example of just about anything you’d need to do with them, so I’m not going to muddy up search results any more than to say that they are really handy tools, especially if you know a little bit about regular expressions.

A Windows Observation

However, I would point out one fairly minor nit that I ran into, at least with the above two ports that I tried.

Both work just fine, but SED I found a tad more troublesome to install. The main problem was that it relies on several external DLLs. You can see these dependencies using DependencyWalker:

image

These files need to be in the same folder as the SED.EXE, and they’re all available at the above link. I guess my feeling is that for such a singular tool, these kinds of dependencies should be compiled in. At one point, many many moons ago, it made at least a little sense to reduce your app diskspace requirements by relying on shared dlls and such. But these days, no one cares if an app like this is 150k vs 500k with all the dependencies compiled in.

AWK (or GAWK), on the other hand, has NO dependencies. None. I copied it to my TOOLS folder, which is on my PATH, and viola! Worked right off. Truly an 0-hassle installation.

They both work very similarly, though SED relies mostly on regular expressions, whereas AWK certainly can be used in conjunction with only regular expressions, but also has the full AWK language behind it to boot.

Speed

One note about speed. There’s nothing to note!

Both of these apps were so fast, even against a 33mb input file, that I didn’t even notice they took any time at all. Running them against this file took about the same time as to actually copy the file.

Granted, my needs were simple, and I’m sure more complex expressions would slow things down. But still. That was refreshing.

And that thing I needed it for?

Removing a singular tag from a large XML file automatically:

awk "!/<\/tag\x3E>/" File1.xml >output.xml

Most of the weird look is from:

  • Having to escape the “/” with a “\”
  • Can’t use a “>” in a batch file command line, because it’s interpreted as a “pipe into an output file” command, which I’ve done at the end of the command with “>output.xml”, so I have to escape it as “\x3E”

I suspect I’ll be using it considerably more in my future!

How to Force a Single Instance of FireFox

0
Filed under Firefox, Troubleshooting, Utilities

We have a multiple computer household, but for some reason, my workstation seems to be the one everyone wants to use to check for directions, their email or whatnot. Unfortunately, as I research issues online, I often leave multiple tabs open as quick and dirty bookmarks till I’ve finished whatever work I was doing.

I happen to use the excellent TabMixPlus plugin for Firefox to manage this, and generally, it works great.

But, from time to time, I’ll sit down to continue work, open Firefox and all my tabs will be gone! Even LOCKED tabs! Ugh.

So a few days ago, I decided to try and track down why.

Turns out it’s pretty easy to accidentally do just that.

All it takes is a few simple (and easy to accidentally perform) steps:

  1. Have an instance of Firefox with tab you care about open.
  2. Under Win7, right click on a pinned Firefox icon and select New Firefox Window.
  3. A completely fresh, empty window opens, but the already loaded window is not “in the background”
  4. Click the already loaded window, and close it.
  5. Now, click the newly loaded empty Firefox window and close it.

At this point, if you reload Firefox, all your tabs will be gone!

It turns out that TabMixPlus, as good as it is, doesn’t quite handle this situation properly. If you close the window with all your wanted tabs FIRST, they will be saved properly. But then, when you close the second window with some other (not your) tabs, when that window closes, those tabs will wipe out the previously saved list!

Yikes!

Now, I can’t really call this a bug on Firefox’s or TabMixPlus’s side. It’s a pretty good example of an odd edge case.

Still, that’s not the way I want it to behave.

The Simple Fix

After some digging around, I’d turned up a number of suggestions, including changing the FireFox shortcut link, adding command line options like “about:Blank”, and others.

However, it turns out that the best solution was in TabMixPlus the whole time, just not quite as I would have thought.

On the LINKS tab of the TabMixPlus config options is the “Enable Single Window Mode.”

image

Just make sure that option is CHECKED.

If you do that, anytime a new, EMPTY Firefox window would have opened, instead, a new tab will open in the existing window.

This still means other users could close your tabs, etc, but they’d have to do it intentionally. It can’t happen by accident.

And… all your locked/protected tabs will stay in place, locked and protected. Those would have to intentionally be unlocked/unprotected to be closed out.

So far, I haven’t run into any issues as a result of enabling this mode, but, obviously YMMV.

KeePass and PhraseExpress

2
Filed under Troubleshooting, Utilities

These are two incredibly handy utilities to have around. I’ve used them for years.

KeePass is a task tray utility for keeping track of and auto pasting usernames and passwords into forms. Works with local applications as well as web forms. The password database itself is highly secure.

PhraseExpress is an “autotype” tool that works across multiple applications, and can even do limited automatic correction of misspelling in any program.

However, when I updated to KeePass 2.18 recently, password pasting into WebForms (Specifically FireFox in my case) stopped working.

Well, sort of.

The username would typically paste in, followed immediately by the password. Even though KeePass was configured to send a TAB key between them and ENTER after the password, those keys weren’t getting sent, so the password paste didn’t work right.

 

Long story short, something changed in Keepass that suddenly makes the “Route Enter and Tab Key Through PhraseExpress” option of PhraseExpress very important.

image

I originally had this setting CHECKED, but that now appears to conflict with Keepass.

Unchecking the setting seems to correct the issue and Keepass works fine now.

I’m not sure what, if any, negative effect there is from unchecking this option though, when using PhraseExpress normally.

Squiggly Spell Checking in Notepad++

0
Filed under Utilities

imageNotepad++ has been a favorite editor of mine for quite some time. It’s quite capable, flexible, fast, has tons of plugins, and continues to be reasonably maintained.

But something that’s been missing is a decent spell checker. Sure there’s the available spell check plugin from the site, but that requires you click a button to spell check the document, and you have to laboriously wade through all the false positives to spell check. Sooooo last century.

However, a recent faux pas with a readme.txt that ended up with some nasty misspellings in it had me off to find something of a solution. I either had to give up Notepad++, or resolve this some other way. Misspellings are my priority 1000 issue!

Fortunately, Karim Sharif has (or rather HAD, back in 2010) come to rescue with his Squiggly Spell Check plugin.

Installation is not for the faint of heart, as it’s completely manual and requires also installing ASpell and making mods to your system’s PATH environment var, but, once it’s going, yeehaw! Nice, Word style squiggly spell check in the document types of your choice, right in Notepad++.

Granted, it’s bare bones, but it works a treat with the latest unicode Notepad++ (version 5.9.6.2 as I write this).

If you use Notepad++, it’s definitely worth checking out.

Authoring VB6 IDE Addins in VB.net

2
Filed under .NET, Utilities, VB6

imageOk, Ok, I know what you’re asking yourself right now.

WTF would you want to do this?

But bare with me.

Realistically speaking, VB6 has a very limited shelf life. I have plenty of VB6 apps that run just fine under Win7 (even 64 bit), but Under Win8? Who knows.

But, the truth is, there are plenty of businesses that rely on WinXP and VB6 apps today, and those businesses aren’t converting those apps to .net (or anything else) particularly quickly.

As it happens, I’m currently doing some maintenance and upgrade work on a VB6 application, and, while it IS a 10+ year old IDE, it does have it niceties and not-so-niceties.

CodeSmart, MZTools, CodeHelper, and other add-ins can certainly help, but one thing I’ve definitely missed now that I’ve worked with VS2005+ is persistent bookmarks and breakpoints.

That fact that VB6 didn’t save bookmark and breakpoint locations is a real shame.

Now, people have asked about this capability for years. I found posts going back to 2001 asking for this function, but the only utility that even came close was the open source CodeDawg project. And while I still have the source here, I can no longer even locate a link for it on the web. No matter, really, because it never did work particularly well, would miss breakpoints or bookmarks that you set sometimes, and just generally had a terribly interface.

But it was a valiant attempt!

Fast forward to today, and I’m back in VB6, working in a large and not particularly straightforward codebase, and I find myself really needing bookmarks and breakpoints that I can set and come back to the next day or whenever.

But .net provides so much simpler coding paradigms for many things now (generic collections, and direct support for subclassing anyone!) that after a few days working up a prototype add-in in VB6, I couldn’t stand it and had to see if it was possible to put something together in .net.

That’s right. A VB6 addin written in VB.net 2010!

It’s not quite finished yet, so I’ll hold off on presenting the full monty for now, but it most certainly is doable, and actually makes for a quite nice development and debugging experience.

First, fire up VS2010 and create a DLL Library project.

In the project  properties, you’ll need to make sure to check the “Make assembly COM visible”

image

Next, On the compile tab, you need to set “Register for COM Interop”

image

You’ll also need to add a reference to the VBIDE.DLL file:image

You can usually find the file under the COM tab on the Add Reference screen:

image

Finally, create a new CLASS, call it Connect, and paste this:

<ComClass("96861C1E-73A0-46E2-9993-AE66D2BC6A91", "1AEA0235-959D-4424-8231-8EBB9B9C85FE")> _
<ProgId("BookmarkSave.Connect")> _
Public Class Connect
    Implements VBIDE.IDTExtensibility

    Private _App As Application

    Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements VBIDE.IDTExtensibility.OnAddInsUpdate
        _App.OnAddInsUpdate(custom)
    End Sub

    Public Sub OnConnection(VBInst As Object, ConnectMode As VBIDE.vbext_ConnectMode, AddInInst As VBIDE.AddIn, ByRef custom As System.Array) Implements VBIDE.IDTExtensibility.OnConnection
        Try
            If _App Is Nothing Then
                _App = New Application
            End If
            _App.OnConnection(VBInst, ConnectMode, custom)
        Catch ex As Exception
            ex.Show("Unable to start addin.")
        End Try
    End Sub

    Public Sub OnDisconnection(RemoveMode As VBIDE.vbext_DisconnectMode, ByRef custom As System.Array) Implements VBIDE.IDTExtensibility.OnDisconnection
        _App.OnDisconnect(RemoveMode, custom)
    End Sub

    Public Sub OnStartupComplete(ByRef custom As System.Array) Implements VBIDE.IDTExtensibility.OnStartupComplete
        _App.OnStartupComplete(custom)
    End Sub
End Class

Now to explain a few things.

The two GUIDs you see in the first COMCLASS line, you’ll need to generate your own unique id’s for them.

Obviously, the ProgID will also need to be changed (the general convention is {addin-name.Connect}).

The Application object is my actual core addin application. I’ve intentionally kept all the addin’s code OUT of the Connect class, to keep it simple, and because this class MUST be made visible to COM so that VB6 itself can instantiate the CONNECT object (and thus kickstart your addin). Usually, the less “stuff” you have to expose to COM in a .net assembly, the better, and this represents the bare minimum.

To make debugging seamless, be sure to set the Debug Start Action to “Start External Program” and point it at your VB6.EXE file:

image

You’ll also need to make sure your addin is registered with VB6, so it will know to load it along with any other addins. You do that by creating a key like the “BookmarkSave.Connect” key below:

image

Be sure to change the “BookmarkSave.Connect” to whatever ProgID you’ve decided on.

Give it a whirl

With all that in place, you should be able to RUN your addin from VS2010, VB6 should start and your addin CONNECT object’s OnConnection method should be called.

Now it’s time to pull out my Duran Duran and SoundGarden discs and get to coding some good ol’ fashioned pseudo-OO VB6 goodness!

Self-Registering COM .net Assemblies

21
Filed under .NET, Utilities

One of the big benefits of the .net system is the fact that it doesn’t rely on COM and the registry to find referenced assemblies. At it’s simplest, the .net loader (which is responsible for resolving external assembly references) looks in the same folder as the assembly that contains the reference, and if the referenced assembly is there, it’s loaded. Done.

Why on earth COM couldn’t have been this way from the beginning is beyond me (ok, actually it’s not, there were plenty of, at least at the time, what appeared to be good arguments for putting all that registration stuff in the registry, but that’s a whole different posting).

At any rate, the new style .net assembly resolution rules work great for .net assemblies, but not with .net assemblies that expose COM objects. And I’m still seeing plenty of projects where COM integration is a primary component. For various reasons, the code for these projects needs to be in .net, so that has left me having to deal with .net COM interop on more than one occasion.

UPDATE: 10/15/2011

I just discovered the <ComRegisterFunction> and <ComUnregisterFunction> attributes, which, initially, I thought might automatically do everything this entire post is about. Doh!

However, that’s not the case. These two attributes can be attached to functions that will be called by REGASM.EXE during dll registration or unregistration. But they do not create the standard dll entry points "DllRegisterServer” and “DllUnregisterServer”. Hence, even if you use these two attributes, you would still have a COM .net assembly that would have to be registered via RegAsm.

Fly in the Ointment

In all honesty, .net COM interop is not too bad. If you know how to use interfaces, the <COMCLASS> attribute, and a few other particular attributes, it’s not much more difficult to create COM components in .net (C# or VB) than it was to create them in VB6.

Except for one thing.

Registration.

COM Components pretty much have to be registered in the registry (ok there’s registry free COM, but that’s another article as well and it’s not often used). For registering COM dlls, the tool of choice has long been REGSVR32.exe. Unfortunately, self registering COM dlls require 2 C-Style entry points, called DLLRegisterServer and DLLUnregisterServer for RegSvr32 to work it’s magic and register or unregister the COM dll. You can see these entry points (and typically 2 others, DllCanUnloadNow and DllGetClassObject) if you open up just about any COM dll in DependencyViewer:

image

Registering a COM .net Assembly

After a little poking around on Google, I came across the RegistrationServices object. This object provides everything you need to register and unregister a COM .net assembly.

Here’s a snippet to actually register a .net assembly that exposed COM objects:

Dim asm = Assembly.LoadFile(AssemblyName)
Dim regAsm = New RegistrationServices()
Dim bResult = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase)

The Unregistration process is very similar.

The Typical Situation

The most common time that a COM dll is registered or unregistered is at installation or uninstallation time. The Windows Installer contains plenty of functionality to register and unregister COM dlls, and .net assemblies, so generally speaking, you often don’t need to even worry whether you COM .net assemblies can be self registered or not, because Windows Installer can automatically handle them.

However, if you want to distribute a dll with no install (maybe an xcopy deployment scenario, or any other situation where an full blown install would be more work than it’s worth), the scene isn’t so pretty. For your COM .net assembly to be registered properly, it will need to have REGASM run on it. REGASM is the .net version of REGSVR32.exe. Unfortunately, REGSVR32 is on the path of every Windows machine out there, so it can be run from anywhere on your system.

REGASM, however, is not. And finding it is often no picknick.

The Ideal Solution

In a perfect world, the Register for COM Interop option in the Visual Studio project options screen, would automatically create the required DLLRegisterServer and DLLUnRegisterServer entry points for you, just like VB6 did. After all, all that’s really necessary for that functions is a call to the RegistrationServices object as detailed above, pointing to the currently running assembly! It’s a trivial bit of code.

But alas, that minor detail was left out.

The Work Around (or ILAsm to the Rescue)

At this point, I knew how to register and unregister COM assemblies. I knew how RegSvr32 functions internally (all it does is perform a LoadLibrary on the given DLL file, attempt to retrieve the procaddress of the DllRegisterServer or DllUnregisterServer functions, call them if they exist, and fail with an error if they don’t).

The only thing missing was how to expose those two functions from a .net assembly as a standard C-style dll entrypoint.

It turns out that neither C# nor VB, at this point, can flag functions to be exported as entry points.

But…. msil (Microsoft intermediate language, what any .net app is initially compiled into) can.

And doing so is quite common knowledge. I’ve actually written about it before, most recently here.

That post mentions the original source for the DLLExport idea and provides a background and code, so I won’t replicate that here. Suffice it to say that essentially, what tools like this do is take a compiled. .net assembly, in which certain methods have been marked with a particular attribute, disassemble the assembly, tweak the resulting IL code slightly to expose those attributed functions as real entry points and then use ILASM to reassemble the tweaked code back into a normal assembly, only now with the entry points exposed.

So, to create a self-registering COM .net assembly, all that’s really necessary is to include this DLLRegister class in your project (along with the DLLExportAttribute class mentioned in the link above):

Imports System.Runtime.InteropServices
Imports System.Reflection

''' <summary>
''' Provides Self-Registration functions for COM exposed .net assemblies
''' </summary>
''' <remarks></remarks>
Public Class DllRegisterFunctions
    Public Const S_OK As Integer = 0
    Public Const SELFREG_E_TYPELIB = &H80040200
    Public Const SELFREG_E_CLASS = &H80040201


    <DllExport.DllExport("DllRegisterServer", CallingConvention.Cdecl)> _
    Public Shared Function DllRegisterServer() As Integer
        Try
            Dim asm = Assembly.LoadFile(Assembly.GetExecutingAssembly.Location)
            Dim regAsm = New RegistrationServices()
            Dim bResult = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase)
            Return S_OK
        Catch ex As Exception
            Return SELFREG_E_TYPELIB
        End Try
    End Function


    <DllExport.DllExport("DllUnregisterServer", CallingConvention.Cdecl)> _
    Public Shared Function DllUnregisterServer() As Integer
        Try
            Dim asm = Assembly.LoadFile(Assembly.GetExecutingAssembly.Location)
            Dim regAsm = New RegistrationServices()
            Dim bResult = regAsm.UnregisterAssembly(asm)
            Return S_OK
        Catch ex As Exception
            Return SELFREG_E_TYPELIB
        End Try
    End Function
End Class

compile the dll, run DLLExport utility on the dll to expose these marked functions, and presto, done!

But wait, There’s More!

This is all well and good, and it definitely works, but using a post-compile process like this is certainly not ideal. If you’ve signed or strong-named your dll during the compile process, that information will be lost during the recompile. Worse, your debugging PDB will not follow through, so debugging the post-processed dll can be tricky as well.

It’d be great is .net had a linker, and we could just link a precompiled OBJ file in that already contained the DllRegister and Unregister functions and export points. Unfortunately, .net doesn’t have a linking process.

A Dead End

However, there is a very nifty utility called ILMerge that CAN merge two or more .net assemblies into one. “Perfect!” I thought, but a quick test resulted in an error from ILMerge indicating that “one or more assemblies contains unmanaged code”. I can only guess that ILMerge doesn’t support exported entry points like this, at least not yet.

I’m Not Dead Yet!

A few days passed, and I was searching for a solution to a completely unrelated issue when I happened upon a page describing Microsoft’s Side-by-Side functionality. Something about the SxS extensions they use all over the place gave me an idea.

If all that the RegistrationServices object needs to register a COM .net dll is the filename, why not create a stub registration dll that contains DllRegisterServer and DllUnregisterServer functions that actually register a side by side dll that contains the actual  COM objects.

So, say you have a dll called MyDll.dll.

Under this scenario, you’d actually put your code into a dll called MyDllSxS.dll (side by side, get it <g>) and then just make a copy of this self-register handling dll and call it MyDll.dll.

When someone runs regsvr32 mydll.dll, the DllRegisterServer function in the stub actually registers the MyDllSxS.dll.

The stub then, is exactly the same for any self-registering COM .net assembly and can just be copied side-by-side as much as necessary.

Granted, this approach does increase the overall application footprint (since there are additional dlls to distribute), but because the extra files are very small (16k or so) and all exactly the same, I don’t see this as a huge issue.

Still Not Perfect

Unfortunately, even though the above approach works great, is simple, and doesn’t require peculiar compilation steps on your codebase, it does still mean you do have a second dll to distribute. And, realistically, if you’re going to do that, why not instead create a little EXE than gets distributed with your app and does the exact same thing as the DllRegisterServer and DllUnregisterServer functions?

Well, honestly, I don’t have a good answer for that. In truth, RegAsm does a little more than just registering and unregistering COM .net assemblies. But for general usage in the field, those two functions are all you really normally need, and building a quick console app to do just that is trivial given the above code.

At then end of the day, for those projects that need COM integration, I’ll probably just include the DLLExportAttribute directly in the project, include the DllRegisterFunctions class to supply the necessary entry points,  and finally run DLLExport on the compiled DLL in the Release mode build of the project to actual export those entry points.

It’s not ideal, but:

  • It works
  • It doesn’t require any  more DLLs than you’d otherwise include in the project
  • It’s not terribly onerous to implement
  • The resulting dlls register and unregister just as a savvy user would expect them to, via regsvr32.

Handy VS2010 Extensions

0
Filed under Subversion, Utilities, Version Control, Visual Studio

I’ve recently had to set up several machines for use with Visual Studio 2010 and found that I just about had to install several extensions, as they’re so useful in normal day-to-day programming.

They are:

  • The NuGet Package Manage (easily pull programming libraries into your project)
  • AnhkSVN for Visual Studio (great Subversion integration)
  • Productivity PowerTools (the “Locate in Solution Explorer” function alone makes this worth downloading)
  • VSCommands (the File Structure Viewer and enhanced syntax highlighting makes this one very nice)
  • DevColor (provided additional functions for setting colors in CSS/HTML files, right from the VS edit window)
  • IndentGuides (visualizes indents. Yeah, so you’re not REALLY supposed to have a for loop that spans pages of code, but hey, sometimes you have to read other people’s code, right? <g>)

There’s tons more extensions accessible from Tools/Extension Manage right inside Visual Studio, so if you haven’t browsed through it in a while, it might be worth a few minutes!

 

Oh, and, two more tools to throw out there. Grab a copy of the freeware Snarl from the guys at Fullphat and then download CommitMonitor, which connects to Snarl and provides you with toast notifications of checkins from other developers in Subversion projects that you care about. Handy stuff if your shop uses SVN.

Traipsing through MSI files with SuperOrca

1
Filed under Installations, Utilities

I’ve done a number of installs over the years (somehow, I seem to always end up with the installation project for whatever product I’m working on/with). It started way back when with a home grown solution, then on to a few minor products I can’t even recall now, then to Wise Installation System (back before Wise spoke MSI), then the little MSI setup project in Visual Studio, and eventually to InstallShield (oh how I miss Wise!).

MSI files are nice. They’re fairly well supported, powerful, capable.

But they can be god-awful difficult to get right sometimes.

And often, when things get tough, it’s often handy to be able to snoop directly into the MSI itself. Microsoft provides a tool called ORCA to do just that.

image

It’s decent. But, you can only get it via the SDK, which is a pretty hefty install. And it’s not great.

But then I happened upon a nifty little tool from the guys at Pantary.com, SuperOrca.

image

It’s a tiny download and fast install. It’s lightweight, but it’s got all the Orca goodness and then some, like an MSI compare function, and a nice search all function.

Now, InstallShield, and I’m guessing Wise also at this point, has a similar “raw MSI” mode, but, if you don’t have the scratch for those apps, SuperOrca might just be the ticket to shedding some light on your next vexing MSI problem.

Printing a Range of Pages from a PDF file, On the Cheap

0
Filed under PDF, Utilities

Lets say you need to print some pages from a PDF file. But you don’t need to print the whole file, just a specific range, say pages 3 to the end of the document.

And let’s say you DON’T have any of those handy (and expensive) PDF libraries available. But of course you do have Acrobat Reader.

And let’s say you’ve got a whole pile of these PDFs that you need to get printed.

What to do?

First with the Printing

A little digging turned up that the AcroRd32.exe application (that actual Adobe Reader app, at least for version 9.x) can be invoked with command line parameters to print a file and exit:

AcroRd32.exe /p /h “filenamehere.pdf”

It’ll print to the current default printer, but that’s good enough for me for this purpose.

Simple enough, but you can’t specify which pages to print.

The Secret Ingredient

I’d almost given up on this when I came across a very handy utility called the PDFToolkit, by Sid Steward. PDFTK is a very small, free, command line driven utility. It won’t print, but it can slice and dice a PDF (or multiple PDFs) just about any which way you can dream up.

Say you have a PDF called input.pdf

You want to print pages 3 to the end of the file.

So, invoke PDFTK like so:

PDFTK.exe A=input.pdf cat A3-end output scratchfile.pdf

and then invoke the AcroRd32.exe line from above on the resulting scratchfile.pdf, and presto, your pdf is printed minus the first two pages!

Granted, if you’re developing a commercial product (or really even an inhouse utility), you’ll be much better served shelling out (no pun intended) a few bucks for a decent PDF library.

But in a pinch, PDFTK and AcroRd32 can be a pretty powerful little combination.

PicPick, A Great Little Freeware ScreenCapture Tool

0
Filed under Utilities

At my last job, we used Snagit exclusively for screen captures. It’s a great tool, but it’s a tad pricey for doing quick screenshots on your home machine.

Just today, I was at a new contract gig and needed to do some screenshots. There wasn’t anything decent already available so I went googling for a bit.

First up. I believe I’ve talked about Faststone Capture before and that’s one of the first hits I got. But after downloading the latest version, I discovered that they’ve gone to a paid version with a 30 day eval. Don’t get me wrong, Faststone is a good screen capture util, and you might want to give it a whirl, but in this case, I was looking for something small and free.

Next try. Struck Gold!

PicPick is a little freeware app from wiziple.net. Odd name, but for free, it’s one amazingly polished screen capture app.

image

Let’s see, what’s to love?

  • It’s got a built in image editor for quick annotations.
  • It can do full screen caps, region caps, window caps, freehand caps, you name it.
  • It’s fast.
  • It can save to several different image formats

and lastly…

It’s got a built in screen protractor! WTH!

image

If you need to do screencaps on a budget, definitely check this one out!