Generating PDFs

C No Comments »

I was looking for a free, open source software library for generating PDFs, and Sean O’Connor pointed me to HARU. I’ll have to check it out.

Smart Pointers Aren’t Quite Smart Enough…

C++, COM No Comments »

What’s wrong with this code? (It is adapted from something I wrote yesterday)

  1. void f()
  2. {
  3.     HRESULT hr;
  4.  
  5.     hr = ::CoInitialize(NULL);
  6.     if (SUCCEEDED(hr)) {
  7.         MSXML2::IMXWriterPtr spMXWriter;
  8.         hr = spMXWriter.CreateInstance(__uuidof(MSXML2::MXXMLWriter30));
  9.         if (SUCCEEDED(hr)) {
  10.             // Use spMXWriter
  11.         }
  12.  
  13.         ::CoUninitialize();
  14.     }
  15. }

Read the rest of this entry »

Writing Streaming XML Using MSXML

C++, COM, Win32, XML No Comments »

In my posts Implementing IXmlWriter Series, I wrote a streaming XML writing class whose interface is based on .NET’s XmlWriter. I recently discovered that MSXML provides its own method to write streaming XML through the class MXXMLWriter.

MXXMLWriter supports a large set of functionality including encoding, indentation, disabling output escaping, and writing XML fragments. The generated XML can be written to an IStream, a BSTR, or a DOMDocument object. However, it’s interface leaves much to be desired. Usage looks like this:

  1. #import <msxml3.dll>
  2.  
  3.  
  4. // I’m using the #import-generated _com_ptr_t-based smart pointers
  5. MSXML2::IMXWriterPtr spMXWriter;
  6. hr = spMXWriter.CreateInstance(__uuidof(MSXML2::MXXMLWriter30));
  7. _ASSERT(SUCCEEDED(hr)); // TODO
  8.  
  9. // Configure the IMXWriter as appropriate.  We will be using the default of
  10. // writing to a BSTR which can be retrieved using spMXWriter->get_output().
  11.  
  12. MSXML2::ISAXContentHandlerPtr spSAXContentHandler(spMXWriter);
  13. _ASSERT(spSAXContentHandler != NULL); // TODO
  14.  
  15. // Be sure to check the hrs below
  16.  
  17. hr = spSAXContentHandler->startDocument();
  18. hr = spSAXContentHandler->startElement(L"", 0, L"root", 4, L"root", 4, NULL);
  19. hr = spSAXContentHandler->characters(L"text", 4);
  20. // endElement also takes the element name.  This means we may need to
  21. // maintain our own open element stack.
  22. hr = spSAXContentHandler->endElement(L"", 0, L"root", 4, L"root", 4);
  23. hr = spSAXContentHandler->endDocument();

The rough IXmlWriter equivalent is:

  1. #include "StringXmlWriter.h"
  2.  
  3.  
  4. StringXmlWriter xw;
  5. xw.WriteStartDocument();
  6.   xw.WriteStartElement("root");
  7.     xw.WriteString("text");
  8.   xw.WriteEndElement(); // /root
  9. xw.WriteEndDocument();

However, there might be a case to change IXmlWriter to use MXXMLWriter internally.

MSXML Versions

Win32, XML No Comments »

The Microsoft XML team recently posted in their blog a set of recommendations on which version of MSXML to use. In short, they recommend using MSXML 6.0 but falling back to 3.0 if it isn’t available.

My product currently tries MSXML 4.0 first — but only SP2 and above. We ran into bugs with previous versions of MSXML 4.0. I will have to evaluate moving to MSXML 6.0.

United States Family Finances

General No Comments »

Via Barry Ritholtz’s blog The Big Picture I ran across the following fascinating article from the Federal Reserve: Recent Changes in U.S. Family Finances: Evidence from the 2001 and 2004 Survey of Consumer Finances.

Airfare Search Engine

General No Comments »

My preferred airfare search engine, especially for international flights, is ITA Software’s Fare Shopping Engine. The month-long search is especially useful if your dates are flexible.

I’ve also heard good things about QIXO.

IE7 Released

Software / Technology No Comments »

Microsoft Internet Explorer 7 has been released. While I will likely remain a dedicated Firefox user, I warmly welcome the improvements that IE7 brings.

Developers: Be sure to test your applications against IE7. My product ran into a bug in our code related to IE7’s move to UTF-8 URL encoding.

Exception Handling: A False Sense Of Security

C++, Error Handling No Comments »

Long-time readers know that I have a bit of a penchant for error handling, especially with respect to exceptions. I just noticed that I have never, to my knowledge, posted about the classic article “Exception Handling: A False Sense of Security” by Tom Cargill.

Read it and weep.

The Federal Government’s FY 2006 Results Part 4: What’s Left?

Political Economy No Comments »

While parts 1, 2, and 3 of this series are a start, there is still a lot left to understand about the Federal budget. To start:

  • How do the numbers look adjusted for inflation? As a percentage of GDP?
  • What was the actual source of new revenues? New spending?
  • If the unified budget deficit was $247.7 billion and the on-budget budget deficit was $434.0 billion, why did the total national debt increase by $574.2 billion from 9/30/2005 to 9/29/2006? Where did the extra intragovernmental debt holdings come from?
  • How are the revenue and spending numbers likely to change in the future? How will we deal with these changes?

The Federal Government’s FY 2006 Results Part 3: How Did Total Outlays Grow?

Political Economy No Comments »

While many people focus on the revenue half of government in that they incessantly clamour for lower taxes, to spend is to tax, as Milton Friedman taught us. Therefore we should look at how the Federal government’s outlays have changed over time. Here is a breakdown of outlays from 2005 and 2006 by major agency:

  FY 2005
Nominal $
(billion)
FY 2006
Nominal $
(billion)
$ Change
YOY
(billion)
%
Change
YOY
Legislative Branch 4.0 4.1 0.1 2.50
The Judiciary 5.5 5.8 0.3 5.45
Agriculture 85.3 93.5 8.2 9.61
Commerce 6.1 6.4 0.3 4.92
Defense-Military 474.4 499.4 25.0 5.27
Education:        
    Office of Federal Student Aid 29.0 48.0 19.0 65.62
    Other
43.8
45.4
1.6
3.65
        Subtotal, Education 72.9 93.4 20.5 28.12
Energy 21.3 19.7 -1.6 -7.51
Health and Human Services:        
    Medicare (gross outlays) 339.4 381.8 42.4 12.49
    Medicaid 181.7 180.6 -1.1 -0.61
    Other
60.3
51.9
-8.4
-13.93
        Subtotal, Health and Human Services 581.5 614.3 32.8 5.64
Homeland Security 38.7 69.1 30.4 78.55
Housing and Urban Development 42.4 42.4 0.0 0.00
Interior 9.3 9.1 -0.2 -2.15
Justice 22.4 23.3 0.9 4.02
Labor 46.9 43.1 -3.8 -8.10
State 12.8 13.0 0.2 1.56
Transportation 56.6 60.1 3.5 6.18
Treasury:        
    Interest on the public debt 352.4 405.9 53.5 15.18
    Other
58.4
58.4
0.0
0.00
        Subtotal, Treasury 410.7 464.3 53.6 13.05
Veterans Affairs 69.8 69.8 0.0 0.00
Corps of Engineers 4.7 6.9 2.2 46.81
Other defense civil programs 43.5 44.4 0.9 2.07
Environmental Protection Agency 7.9 8.3 0.4 5.06
Executive Office of the President 7.7 5.4 -2.3 -29.87
General Services Administration 0.0 0.0 0.0 0.00
International Assistance Programs 15.0 13.9 -1.1 -7.33
National Aeronautics and Space Administration 15.6 15.1 -0.5 -3.21
National Science Foundation 5.4 5.5 0.1 1.85
Office of Personnel Management 59.5 62.4 2.9 4.87
Small Business Administration 2.5 0.9 -1.6 -64.00
Social Security Administration 561.3 585.7 24.4 4.35
Other independent agencies:        
    Postal Service -1.2 -1.0 0.2 N/A
    Other (net)
15.6
13.3
-2.3
-14.74
        Subtotal, other independent agencies 14.4 12.4 -2.0 -13.89
Undistributed offsetting receipts:        
    Employer share, employee retirement -58.9 -60.9 -2.0 N/A
    Interest received by trust funds -161.0 -169.3 -8.3 N/A
    Rents and royalties on the Outer Continental Shelf lands -6.1 -7.3 -1.2 N/A
    Other
-0.2
-0.1
0.1
N/A
        Subtotal, undistributed offsetting receipts -226.2 -237.5 -11.3 N/A
Total outlays 2,472.1 2,654.4 182.3 7.37
    Total on-budget outlays 2,069.9 2,232.3 162.4 7.85
    Total off-budget outlays 402.2 422.1 19.9 4.95

As a reminder, all numbers are from the U.S. Treasury Preliminary Statement of Budget Results for Fiscal Year 2006. Figures are not adjusted for inflation.

I don’t understand why “undistributed offsetting receipts” are counted as negative outlays and not receipts. Regardless, the three largest increases in outlays in percentage terms were from Homeland Security, the Office of Federal Student Aid, and the Corps of Engineers, respectively. The three largest increases in outlays in dollar terms were from Interest on the public debt, Medicare, and Homeland Security, respectively.

The Department of Defense, Medicare, Medicaid, Social Security, and the Interest on the public debt comprise over 75% of all Federal spending. However, Social Security is currently running a surplus. If you were to eliminate Social Security along with its associated, dedicated taxes, you would make the Federal deficit quite a bit worse in the short term.

Given current trends, future obligations, and political realities, I am highly pessimistic about the ability to address the Federal deficit from the spending side. The supermajority of future improvement will likely have to come from the revenue side. This means, of course, higher taxes. However, the longer we wait, the more likely it is that Interest on the public debt will continue grow far faster than the rest of the budget, which will make future tax increases or spending cuts even more painful.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in