Saturday, 25 July 2009
A client asked me to help recently with a small mystery. They had a database provided by a customer and they'd been asked to import the contents into the tables used by their own product. One of the tables had a BLOB column and from context they were quite sure it was used to hold scans of documents. There was even a "filename" column and a "filetype" column that suggested very strongly the scans were stored as TIFFs.
It had taken a while to find code to read the blobs, and when they ran it, the resulting file was rejected as not being a valid TIFF. They weren't sure if they were handling the blobs wrongly, if the data was encrypted, or if it was some other image format (they had tried PDF and GIF already.) In a highly enjoyable two hours, here's what I did:
- Found short (ten lines including initialization and cleanup) code to read one blob in VB6 and save it to disk.
- Found the TIFF format details, looked in the resulting file with notepad and confirmed it didn't start either II or MM and so wasn't a TIFF.
- Looked at a few other file formats but wasn't really gaining any knowledge, just ruling things out that you could rule out by renaming and double clicking, then having the file rejected by the app that tried to open it.
- Discovered Marco Pontello's absolutely cool File Identifier, TrID, and downloaded it
- Removed the extension from what had been test.tif, pointed TrID at it, and was told 100% it was a zip file. Duh, the file started PK, I might have guessed that one.
- Renamed it to test.zip, unzipped it by hand -- ooh, it IS a zip! -- and was rewarded with file.txt for my trouble
- Looked at file.txt in notepad and noticed that it was full of binary-looking gibberish, but it DID start with II
- Hand renamed file.txt to file.tif and double-clicked it
- Presto! A scan of a document!
I left my client to write the code that did all the blobs, including unzipping them and renaming (every single blog contained a zip which contained a TIFF renamed to file.txt and no, I don't know why) from within a quickly written importer application. The big mystery was solved. Thanks, Marco!
Thursday, 23 July 2009
I admit it, I read my referrer logs. I want to see what kinds of searches bring people here, or who is linking to me. I think a lot of the single word searches (women, or shirt, or december) are blog spammers looking for posts to spam on. And some are clearly my name, names of my friends or folks I blog about, conferences I'm speaking at. The majority is things I know about, things for which I want to be your expert source: /clr:pure, windows 7 taskbar, uac manifest file, marshal_as and so on. Yay.
But this one was just plain odd: c++ standard limerick. Really? So I repeated the search, and found this:
When writing a specialization,
be careful about its location;
or to make it compile
will be such a trial
as to kindle its self-immolation.
OK, it's not spaced like that in the standard. But who'da thunk it?
Tuesday, 21 July 2009
Want to go to PDC but not sure you can afford it? How would this work for you: a trip to PDC including flights, hotel, and conference admission?
That's the grand prize in the INETA Component Code Challenge. Write an app (web, client, whatever) that uses at least two different components (a grid and a chart? a PDF creator and a calendar? a report and a spreadsheet? You decide.) from the sponsors.
Try it! And maybe see you in LA!
Sunday, 19 July 2009
Here's another tip from Habib on debugging. If you have a particular screen you want to bring up, and it takes a lot of clicking and selecting to bring it up, why not just set a breakpoint and then bring it up by constructing and calling it with the immediate window?
Habib's video features a WPF application, and the constructor takes no parameters, but you could use this for Windows Forms and you could pass through whatever parameters you needed to. A very handy tip - any language, any kind of client application.
Friday, 17 July 2009
It's been a while since I did a series of posts on debugging tips:
So here is not so much a tip as an announcement. You see , it's no coincidence that my examples for conditional breakpoints were numbers (some index into a structure is greater than 346, or Xid is 1234.) Until now, you couldn't really use strings in conditional breakpoint expressions. But the cool news is that, starting with Visual Studio 2010, you can!
You can't just call arbitrary functions including your own foo(whatever), but you can call a pretty impressive list of variants on strlen and strcmp. The details on are Habib Heydarian's blog. Just one more reason to want Visual Studio 2010!
Wednesday, 15 July 2009
Finally, XP2Win7 is released
! I've been watching this one for a long time. It's designed to show off both Windows 7 features and development good practices. The same binaries behave differently on XP and on 7 - on 7 it lights up and shows 7 features like the taskbar or libraries support, as well as Vista features that never got the attention they deserve like Restart and Recovery.
The application itself is a photo viewer and that makes it a natural fit for hooking into libraries, search and organize, and the preview system. It has an intuitive jump list on the taskbar:
It also uses the new Sensor support, Aero glass effects, trigger-started services for backing up images when a USB key is inserted, MMC and Powershell integration, the new Event Tracing for Windows (ETW) and so much more. This will be your roadmap to Windows 7 development. Of course all the code is available, as well as a simple MSI if you'd just like to play with the application a bit and understand what Windows 7 has to offer.
Get your copy and start learning and exploring!
Monday, 13 July 2009
A whole pile of really smart people, many of whom I am lucky enough to call my friends, have contributed to a new eBook on development topics. Check these titles:
- Working with Brownfield Code by Donald Belcham (Microsoft MVP)
- Beyond C# and VB by Ted Neward (Microsoft MVP)
- Remaining Valuable to Employers featuring Barry Gervin, Billy Hollis, Bruce Johnson, Scott Howlett, Adam Cogan, and Jonathan Zuck
- All I Wanted Was My Data by Barry Gervin (Microsoft Regional Director and MVP)
- Efficiency Upgrade by Derek Hatchard (Microsoft Regional Director and MVP)
- Getting Started with Continuous Integration by Sondre Bjellås (Microsoft Regional Director and MVP)
- On Strike at the Software Factory by Daniel Crenna (Microsoft MVP)
- C# Features You Should Be Using by Ted Neward (Microsoft MVP)
- Accelerate Your Coding with Code Snippets by Brian Noyes (Microsoft Regional Director and MVP)
- Is Silverlight 2 Ready for Business Applications? by Jonas Follesø (Microsoft Regional Director and MVP)
- Innovate with Silverlight 2 by Daniel Crenna (Microsoft MVP)
- Real World WPF: Rich UI + HD by Gill Cleeren (Microsoft Regional Director and MVP)
- Hidden Talents by Peter Jones
- Creating Useful Installers with Custom Actions by Christian Jacob
- Banking with XML by Peter Jones
- Sending Email by Derek Hatchard (Microsoft Regional Director and MVP)
Also, it has comics in it. Really. And if you prefer a printed copy, you can order one (black and white or colour) at a nominal cost. And these aren't little blog posts, they're decent length articles. All told the PDF is 132 pages. Each article conveys, on top of the technical information you'd expect, a glimpse into the personality and style of the author. A highly recommended download and read.
Update: This whole recommending thing works even better when you include a link: http://devshaped.com/book. Slow brain day today, I guess.
Saturday, 11 July 2009
Remember that post by Aaron Margolis I linked to
about launching a non elevated app from an elevated one? I mentioned that he'd left the managed version of his code as an exercise for the reader. Well Sasha Goldshtein has taken up that challenge and written the managed code
. Not only that, he's added it to his UAC Helpers project
on CodePlex, a collection of code that helps you work with UAC. Nice!
© Copyright 2018 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Thursday, 18 January 2018 00:40:16 (Eastern Standard Time, UTC-05:00)
On this page....
Pluralsight Free Trial
Click Subscribe, then Start 10-Day trial