Archive for the ‘Work’ Category

SOAP vs. XML-RPC

Thursday, May 1st, 2008

Having spent copious amounts of time making a .NET client successfully interoperate with Java based web services, my level of frustration is rising. Fast.

I am not even going to begin to enumerate the problems that I have encountered, but they have been mostly related to various WSDL formats, some of which are unsupported by .NET, and some of which are unsupported by various Java based web service frameworks.

So, admitting failure, I decided to look into SOAP alternatives, and I came across XML-RPC. Unlike SOAP/WSDL, XML-RPC is extremely simple: The specification is 8 pages including examples, and there are client and server implementations for pretty much any language you can think of. So, what’s the downside to XML-RPC compared to SOAP (taking into account that I was going to use SOAP over HTTP only anyway): Well, WSDL, basically. XML-RPC does not statically define its endpoints, instead it is up to the client to know what methods/parameters are supported by a given XML-RPC service. Also, SOAP supports a number of data types not supported by XML-RPC, but not really anything that causes problems.

Depending on the server implementation used, it is in fact possible to automatically generate clients (kindof). More on this in a little while.

Running apache Tomcat on Mac OS 10.5

Tuesday, April 15th, 2008

This post simply details the caveats related to running apache tomcat + apache axis 1.3 on Mac OS 10.5.

Thanks to this blog post, I figured out that this exception:

java.util.regex.PatternSyntaxException: Dangling meta character ‘*’ near index 0
*.local
^
at java.util.regex.Pattern.error(Pattern.java:1650)
at java.util.regex.Pattern.sequence(Pattern.java:1787)
at java.util.regex.Pattern.expr(Pattern.java:1687)
at java.util.regex.Pattern.compile(Pattern.java:1397)
at java.util.regex.Pattern.<init>(Pattern.java:1124)
at java.util.regex.Pattern.compile(Pattern.java:817)
at java.util.regex.Pattern.matches(Pattern.java:919)
at java.lang.String.matches(String.java:1921)

Was caused by broken regular expressions in the proxy configurations for both the ethernet and airport network interfaces. Removing those entries fixed the problem.

More caveats probably to come.

Apache on Mac OS X

Wednesday, March 19th, 2008

As it turns out, OS X comes with apache 2 preinstalled. It even has a recent version of php5 as well. I don’t really understand why they disguise this fact as the ability to “Enable web sharing” under the “Sharing” system preference. Oh well.

Anyway, as it turns out, the version of php installed with OS X 10.5 has been compiled without support for SOAP, which I basically can’t do without. I’ve been googling around, but I have so far failed to come up with a way to recompile php for the version of Apache supplied by OS X. In stead I am now trying to get it working through Fink. I guess the supplied version of Apache is indeed only intended for basic file sharing, and not for development purposes.

Now, I only wish fink had a binary distribution for OS X 10.5. Compiling everything takes, well, forever.

Switching to a Mac Book Pro

Tuesday, March 18th, 2008

As I wrote here, I’ve recently switched jobs. Although I haven’t actually started work, I have received my new laptop. It’s a brand spanking new Mac Book Pro. So I am now trying to figure out how and if I like Mac OS X compared to Xfce.

Mac Book Pro

So, what’s good and what’s bad about Mac OS X.

The good:

  • I absolutely love the tight integration between OS components. E.g. how easily bluetooth devices are configured via the user interface, how the user interface and network can be configured,  and how every hardware peripheral is instantly usable through the user interface. I can’t count the hours I have spent making these things sort of work Xubuntu/Xfce.
  • Software availability is generally better on Mac OS X than is the case on Linux, especially now that I have fink working. I especially like that I am now able to use reasonably new versions of skype and google earth.
  • My favorite games like Warcraft III and StarCraft work on OS X.
  • Applications may be bound to a specified virtual desktop, forcing them to display there, whenever they are started.
  • IPod integration is obviously very smooth.

The bad:

  • Poor keyboard shortcut support for manipulating windows. There are various hacks around which use apple script to support trivial things like maximizing any window. Basically, though, native OS X support for these things suck.
  •  No sloppy focus (or focus follows mouse). This is probably the biggest drawback of them all. For the life of me I cannot comprehend why people insist on clicking to give windows focus, when the same thing may be accomplished by simply moving the mouse.

More of these will probably surface when I’ve spent a bit more time with OS X.

Side effects in library files are evil

Monday, November 5th, 2007

Recently I’ve been working on a medium sized php-based web site. The code is written in php, and clearly not by someone experienced in the black art of readable code. I never really considered it before, but it just occurred to me that side effects (eg. changes to global state) in library files are just utter crap. Anyone writing code based on such foul practices really should not be allowed near an editor ever again.

Let me explain.

Imagine including functions.php from the file index.php. functions.php in turn includes functions1.php and functions2.php. These of course may include even more library files ad nauseum. One of these files sets the variable $obscure_result. Not only that, but a few other files (also included) modify the value of $obscure_result based on some criteria.
Now, assume that $obscure_result turns out be wrong, or it needs to be calculated in another way. First, attempting to even determine where $obscure_result gets modified is a pain, since it requires an analysis of which files actually get (recursively) included. Additionally, each of these files must be checked to see if their changes to $obscure_result depend on some other bit of state (which in turn may also be a global variable modified throughout various included library files). All in all, side effects in library files are a nightmare, and should be avoided, lest you are into pain and suffering.

On writing C++

Wednesday, October 31st, 2007

A while back I started a new job at Marimatech. The job as well as the colleagues there are excellent, and it has given me an opportunity to brush up on my somewhat rusty C++ skills, as we are rewriting a rather large protocol stack more or less from scratch. I never actually took the time before, to write anything of a reasonable size in C++, so actually doing that has taught me a great many things.

Love your debugger.

In this case that means gdb, which is incredibly powerful, but has a somewhat steep learning curve. Once you master the basics, however, fixing segfaults and logical errors becomes much simpler then with the printf() (or cout) method which has worked so well in the past. Debug and error logging is still incredibly useful, but running programs in gdb makes lots of errors trivial to find.

Love your profiler

In this case that means valgrind. Like gdb it is extremely powerful, and comes with tools for profiling as well as for detecting memory leaks. Having never really needed a profiler before, I am thoroughly impressed. Of course kCacheGrind makes working with valgrind sweeter still, almost to the point of being too easy.

Long story short, C++ is starting to grow on me. I am pretty sure that writing in C++ once in a while improves my programming skills with respect to other languages as well.