/home/jeff/blog

Sucking away valuable moments of your life ...

Backing Up MAPI Contacts and Calendar From Exchange Server

| Comments

I have a hate/hate relationship with Exchange Server. I hate it, and I’m pretty sure it hates me.

Why someone would design a system to expose every bit of data for a system through a nice standard protocol like IMAP, then only allow certain things to be viewed through a piece of crap proprietary protocol like MAPI just boggles the mind. I’m sure it’s part of their “vendor lock-in” thing, but it just pisses me off.

Anyway, I found out that to completely backup an Exchange account (as I have been doing over the last week or so for different accounts), you also have to backup the non-mail portions. I ended up using a deprecated library called Jakarta Slide for WebDAV client support, which helpfully came with a SearchMethod call which was capable of running the specialized XML query required to backup the data.

The XML I ended up using was:

SELECT * FROM "URL"

in case anyone is interested. Again, I have a fatjar of this utility, but I have to check with work to make sure they’re okay with me releasing it before I can post it anywhere.

IMAP Synchronization

| Comments

I hate it. IMAP Synchronization, that is.

In an effort to migrate users from one *shudder* Exchange provider to another (after getting shot down for proposing first Zimbra, then standard mail server stuff, then Openchange), I have been going through all of the available IMAP sync software that I could find.

mbsync () – We use this for IMAP backup, so I figured it would be a good idea to try it for syncing between two IMAP servers. *Crash*. *Segfault*. This is one of the reasons I’m not a big fan of really low-level apps written in C.

imapsync () – Written using a Perl library, this offered the promise of fast syncing, and appeared to work in test runs. That is, until it encountered folders with spaces in them, and threw up all over the terminal. Really, it wasn’t a use-case for *anyone* to have spaces in folder names? I could have put some effort into fixing the library and/or script, but I figured that if something that basic wasn’t working for a fairly mature library, this wasn’t going to be pretty.

The Imap Migration Tool () – Written in PHP, with a two or three step process. Was meant for moving stuff, not keeping them in sync, so running multiple times would cause additional copies of messages to be created. Also, it seems to have been written in some prehistoric form of PHP, which required hacking to get it even marginally functional. Even then, it spat tons of warnings and nasties, which made me a little nervous to use it on any important mailboxes.

mailsync () – I don’t even remember why this one didn’t work, only that I wasted a fair amount of time playing with it to get it to try to migrate using the scheme we were working with to no avail. Scratch another one.

Solution … I had to roll my own. This is *stupid* to the highest degree, but I rolled something using javamail into a self-contained “fat jar” using fatjar. It works sickeningly well, and actually respects existing messages by message id, so that if for any reason I have to break the sync process, it’ll skip past anything it has already done. I made it non-destructive because it seemed like seriously bad juju to have a sync tool purge out email…. If I get permission from work, I’ll post the jar for anyone with Java 1.6 to use.

As an aside, it took a little bit of hackery to get fatjar running outside eclipse. The relevant section of build.xml was:

Exposing SOAP Services With Apache’s ProxyPass

| Comments

I have recently had cause to proxy a J2EE CXF service through an apache 2.2 instance, and thought it would be nice to share my findings. (This was all done on a Debian system.)

First of all, the mod_proxy pieces have to be enabled using a2enmod proxy.

A fragment has to be added with the proxying bits and some limitation:

     Order allow,deny
     Allow from all


ProxyPass /EXPOSEDURL http://SERVER:PORT/URL
ProxyPassReverse /EXPOSEDURL http://SERVER:PORT/URL

Reloading apache configuration should enable the proxy properly. The only other possible issue is that in addition to the WSDL URL, you’re going to have to specify a “proxy” URL, which is just the service URL without ?wsdl at the end of it. A fragment of PHP’s SoapClient would look like this:

$url = "http://server.domain:8180/services/MySoapService?wsdl";
$sc = new SoapClient( file_get_contents($url), array(
          'login' => $my_username // optional for basic auth
        , 'password' => $my_password // optional for basic auth
        , 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP
        , 'location' => str_replace('?wsdl', '', $url) // force this to work through proxies
));

The magic in that last segment was the “location” parameter, as it specifies the proxy. Good luck!

Community Projects and Bug Fail

| Comments

I really like Ubuntu — I use it for all of my workstations/laptops, and have for the last several years. I do not, however, like it when people tell me that something that’s clearly and demonstrably a bug in a system simply isn’t a bug. Fie on your crappy PPA build system, I’m just not going to build more Ubuntu packages for things. I’ll just go back to only packaging Debian server packages.

Way to build community, Canonical.

I quote:

The buildds[sic] have no internet access, so you can’t use installer packages (packages which need to download the undistributable archive from the official location) on buildds (e.g. as build dependencies).

I swear, it’s a feature, not a bug.

Kill Bill

| Comments

Kill that damn “healthcare” bill. Kill it dead.

I’m as shocked as anyone else that I’m agreeing with morons who wear teabags on their hats and think that universal healthcare is some bizarre form of fascism, and that everyone is a Nazi. Not to fear, I’m not agreeing with them on *everything*, just on one thing: this “healthcare” bill sucks.

We saw a 100 bump in the DJIA this morning after the Senate passed their bastardization of a health insurance industry subsidy bill. Of course, it had to do with the excise tax being delayed, supposedly. Not anything having to do with 25 million new customers being forced into an industry with little or no regulation. Nope, not that.

Progressives are counting on the bill to be improved on its way back from the House, claiming that it will be better than the version that the Senate watered down. Y’know, because it makes so much sense that these cretins who tear every good measure out of a bill with the mere threat of a tantrum (without having to do the “Mr Smith Goes to Washington” thing) are just going to smile and say “I know we didn’t do this before, but of *course* we’ll do it, now that the House of Representatives said it was okay!” I can’t figure out who are the bigger morons, the Senate democratic leadership or the guys in the Progressive movement eating this up like Frosted Shit Flakes.

All our lame duck president had to do was push single payer, really. It might have been the end of his political career, but would have, much as the civil rights movement revolutionized America, drastically changed the way we live our lives in this country. No more would medical bankruptcy be something with which many families are familiar, and no longer would people fear financial ruin from attempting to seek medical care. I can’t condone mandated private insurance with no real caps on what they can charge or what horrible things they can do to you when you don’t play by their rules.

What happened to this guy? Who traded him out for this dud? With what? Oh yeah. Money. Power.

Give up the idea that you as a person can do anything. We’re peons, slaves to a country bought and paid for by large industries.

If you don’t believe single payer is not only superior in every imaginable way to the nightmare we have now and would also save us *billions* of dollars, please visit Physicians for a National Healthcare Plan. The huge list of studies, including CBO ones, are eye-opening.

Is it the best possible thing? No. I’m sure there are better systems, somewhere. It’s not socialized healthcare, just socializing the payment structure for it. And that’s not a dirty word, morons. We socialize a lot of things for the common good. Haven’t heard too many fiscal conservatives griping about that 636 *billion* dollar spending bill. Oh yeah. ‘Cause it helps us kill the Al-Qaedas that aren’t in Afghanistan and continue blowing holes in the sand to fill them with bundles of freshly printed dollars. Like that ever helped anything. Would you like a terrorist-repellent rock?

But we’re going to mouse and complain that the government wants to take away our liberty and little American flags. I’d be more concerned with ceding government power to corporations. Privatization doesn’t make things better, it just tacks on a profit “tax” to a social venture. Look at California… that shit is falling apart.

Not to worry. Your healthcare system will be following suit. Please try not to die on the sidewalk.

US Healthcare Reform Is Dead

| Comments

Yep, that’s it. It has been dead for quite some time now. Unfortunately, it’s not always apparent *why* that has been the case.

Warning: Political and healthcare-related opinions below, linked to various reputable sources.

Public Option, Single Payer, Medicare for All? The most contentious part of healthcare reform has been the concept of a government run health care plan. HR 676 refers to the idea of “Medicare for All”, extending our Medicare program for seniors to cover all Americans, effectively creating a single payer system in America. As expected, people who didn’t give a crap about running up deficits to blow holes in the sand halfway across the globe were outraged, *outraged* at the idea that we could possibly spend money on healthcare. So much, in fact, that they paraded around like morons, complaining about how large and awful government has gotten. (You know, after they didn’t say jack since the *last* Democrat was president.) A simple google search seems to show that the only places that are worried about Medicare deficits are right-wing thinktanks like the “Heritage Society” and Pravda-like news organizations like “Fox News”. Did I forget to mention that Kaiser and BCBS were up there as well? Trusting insurance companies to control costs in healthcare is like handing over a chicken farm to a drooling fox. No mention whatsoever that estimates of savings with single payer are in the hundreds of *billions* of dollars. And those estimates aren’t some cherry-picked thinktank garbage. It’s from the CBO. PNHP has a substantial list of studies which all seem to conclude that we’re flushing money into private insurance companies. Not to mention that 59% of doctors favor it.

Don’t let that fool you. The Insurance companies *love* this new bill. For all their hemming and hawing, the health insurance complex is almost giddy with this new bill, which would allow them to effectively [dump the lowest income, highest risk people][8] onto a publically subsidized [but privately run][9] healthcare system. All the profits, none of the risk. Sounds like Goldman Sachs 101 to me. In a related vein, one of the major reasons that the banking and financial industry has come out against HR 676 was that part of it

Tis the Season

| Comments

It’s getting closer and closer to the big holiday of the winter season. Hell, let’s just call it the “Christmas Season” and get it over with; it’s the 900 pound gorilla in the figurative room.

Christmas, or to be more specific, Christmas *shopping* is the most important time of the year. Economically, that is. Small shops and large chain outlets alike rely on the boom of Christmas present sales to create the bulk of their sales figures for the year.

But what’s this? There’s a recession going on? People are getting laid off, salaries and benefits are being cut, premiums are rising (and affecting paychecks as well), foreclosures are through the roof, over 120 banks have failed this year while the FDIC is perilously close to being completely out of funds, inflation is getting out of hand, cost of consumer goods are going up while wages are going down.

Not to fear! The powers that be have devised a way to give all of us peons a little more cash, and in effect, artificially buoy sales figures by extending unemployment benefits until just after the “holiday season”. That way, you’re still screwed with no job in an economy that isn’t hiring, but at least you can buy some stuff you don’t need so that those Wall Street stocks don’t go down. Can’t upset that parasite investor class, now, can we? (Incidentally, Naomi Klein had a fantastic piece on the death of the ownership society and how the entire concept of haves and have nots is coming back into the public consciousness)

I remember remarking a few years back that the crappiness of the economy seemed to correlate with the earliness of Christmas (or to be PC, “Holiday”) sales. If that holds up, we’re in the toilet, as the sales started around Halloween this year.

I’ll end this on the thought that I’d rather the “Holiday season” be about spending time with family and charitable works than an ad-hyped spend-yourself-to-the-dole-queue orgy of greed and gift arms race. That’s what all these holidays are supposed to be about, right? Christmas is about a figurative birth of a way of life, Hannukah is about maintaining a way of life in the face of oppression, Kwanzaa (… is a made up holiday, as they all are), but is about culture and unity, and Yule is the end of one cycle and the beginning of another. Drop the greed, do a good deed, and have a happy new year!

Serial and Parallel Interfaces in Java

| Comments

To sum up before I even begin: they *suck*.

One of Java’s exceptionally weak points is serial and parallel interfaces, since it’s not within the normal bundled class library specification. In developing for Linux systems, I found that there are two basic routes you can take, being Java Communications API and RXTX, with the latter being a reimplementation/extension of the former. To say that these are painful to work with doesn’t adequately state the gravity of the situation.

For example, the javax.comm.properties file needed by both libraries has to exist in the classpath or buried deep in the JRE. This is an offshoot of the issue that they require JNI libraries to function, which debian handles nicely in the form of a librxtx-java package which does most of the heavy lifting with the exception of that nasty properties file. In dealing with a J2EE app, this becomes a pain if you want to stick with the “single file” WAR deployment. Eventually I baked an additional instruction into my build.xml file to relocate the properties file on execution.

The documentation for rxtx, at least in terms of practical examples, is horrid. The wiki server isn’t up and running (at least when I went to look) and the only evidence that anyone had ever tried to use this library for the purposes I was looking to use it for were a few old javadocs and a handful of mailing list entries.

This really should *not* be this painful. Virtually every system targeted by the JRE has I/O devices which should be covered by the scope of the basic class libraries. I should not have to practically reinvent the wheel simply to push data out to a peripheral.

By the look of the documentation, this wouldn’t have been any easier doing it with Windows, and I believe I managed to kill its ability to be cross-platform in any meaningful sense when I decided to use RXTX. This is just as bad as those asshats who make completely crossplatform applications then tie them intrinsically to Windows in some completely brain-dead way for no apparent reason.

Hey Sun, when you made this specification, could you have possibly thought to include support for devices which have been around since 1969

A Few Observations About Android

| Comments

I’ve been in the process of teaching myself the Google Android platform over the last few weeks, as my work has had a contest devoted to creating a mobile phone app, with a prize attached. I’m the only entrant who doesn’t work in the Engineering department, so this is a bit of a professional stretch for me as far as my job is concerned.

I have found quite a few caveats in the development process which are worth noting, as I have spent a fair amount of time researching them to figure them out. (I should also note at this point that this is in no way downplaying the important role Android plays in the future of mobile phone platforms, and is definitely *not* advocating either WinMo, which is a horrible abortion of a platform, or iPhone, which is not only locked to a single vendor, but *requires* purchasing a Crapitosh for development as well as a minimum 99$ development license to get going …)

1) Camera Access – It took some digging to find that you have to allow permission android.permission.CAMERA, or else it’ll throw out of memory errors and crash the app. I think it’s a running bug that in Android 1.6 it isn’t throwing a proper “PermissionDeniedException” or whatever else they feel like calling it. Otherwise the Camera API is pretty powerful.

2) Getting your own phone number – This is very interesting, as Android just moved to using something called “TelephonyManager” to deal with all of this. Unfortunately documentation hasn’t quite caught up to it. An example:

TelephonyManager mTelephonyMgr = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); 
String imei = mTelephonyMgr.getDeviceId(); 
String phoneNumber=mTelephonyMgr.getLine1Number(); 
String country = mTelephonyMgr.getNetworkCountryISO(); 

3) Saving state – If you want to save state for your app, it makes no sense to go any further than SharedPreferences. It keeps you from having to create a content provider to deal with keeping that information stored somewhere else …

4) AppWidgets are awesome — The idea of a “home screen” applet is really easy to implement simply by extending AppWidgetProvider and add a XML element to the AndroidManifest.xml file corresponding with the class.

5) Opening an intent from a menu item – The documentation says to use *a* Context, but doesn’t mention that you should be passing the Activity subclass that you’re coding to use as the Context.

Metaphor Du Jour

| Comments

For those who don’t know much about my life or daily habits, I have to commute into Framingham, Massachussets most days for work, which is about an hour drive from Northeast Connecticut, where I live. Unfortunately, this means spending a fair amount of time in traffic, as well as on the Mass Pike, which is the sorry excuse for mass transit across Massachussets. Americans think of mass transit as highways instead of rail and its compatriots, for one reason or another.

Getting on or off that road is a little dangerous — drivers in Massachussetts, less-than affectionately referred to as ‘Massholes‘ by drivers in other states, seem to have some hideous mental block which keeps them from being able to merge into traffic. A single lane merge on the Mass Pike can backup traffic for miles on some days. Instead of following the customary turn-taking merge technique which has become so commonplace in other parts of the country, drivers in the “Make it yours” state just slam their heavy feet down on the accelerator and attempt to cut off every other driver on the road.

It struck me that this is a pretty decent metaphor for the issues with the illusion of “pure capitalism” mentality that has become so prevalent in this country. Common sense dictates that by not being rude to your countrymen and displaying common courtesy, everyone does better. You may get to work a few minutes later, or possibly everyone could get to work on time. People don’t need to step on other people to get ahead — they can still get where they’re going, but it’s far better for everyone involved to not be such a dick about it.

And the second part of the metaphor is that if we just went with mass transit, we’d probably be better off, but no one is going to do it because we can’t show anyone our large shiny chrome and plastic wangs. Sadly, that might be the more apropos part of the metaphor.