Month: May 2008

Soap4r woes

Just in case this burns someone else

Talking to a web service that returns an array of mixed complex types (ooh goody!)

soap4r returns a lot of SOAP::Mapping::Object

These pretend to be a kind of hash (of hashes of hashes if you go really deep), so I could get my proposal back by the rather horrible

response.submitResult.returnMsg[‘Proposal’]

(lots of console work required to get this far .. :))

I needed the proposal’s ID and it was nowhere to be seen. When I looked at the wire trace it told me that the proposal ID was being returned as an attribute of the Proposal XML node.

Lots of pain and headscratching later discovered a blog post talking about the semi-hidden xmlattr method, this is a proper hash but it is indexed using the qualified name class XSD::QName

So, to get the ID out we end up with …

proposal_id_key = XSD::QName.new(nil,‘proposalID’)
response.submitResult.returnMsg[‘Proposal’].
xmlattr[proposal_id_key]

Let the joy be unconfined … SOAP is another unnecessary PIA. Most of the time you could just post XML direct using HTTP. I can’t see any benefit for the additional complexity.

If we did’t have soap4r I’d still be banging my head on the desk so +1 for that …

Top tip, you can set $DEBUG=true in the console to get the wire trace.

Meditation and Depression

Comment left here. 

My lama says that you should allow your subjective pain to awaken compassion for others that also suffer from whatever condition you are suffering with. Then take the medicine!

I no longer need to take antidepressants and I put this down to many years of practice. But Buddhist meditation is not therapy: it’s goal is enlightenment. This is why the Dharma is taught.

That said, calming meditation really helps to clear the mind of that nagging negative voice that informs depression and damages your chances of happiness in this life. I did this by learning to recognise it and then prevent it gaining energy and starting a loop in my mind. My personal experience is that it is like having a constant noise in your mind that spoils everything and makes it very hard to think and feel anything but despair that it will never end. Eventually you move on past it. Or I did, anyway. I also found the first Noble Truth, impermanence, a great help, because it meant that the was a light at the end of the tunnel and my pain would end.

A friend said (probably a quote somewhere), “if you are going through hell keep going until you get to the end”. Good advice I think.

Bootnote – here is another post against the same topic

I do’t need to focus on the pain – it’s always there, constantly. I just do’t give it any energy any more. I recommend the Tibetan practice of lo johng (not sure of spelling) – “sending and taking”, which the Dalai Lama describes in one of the “Essential Teachings” series – need to track the proper reference.

I also would’t embark on this without some instruction from a qualified teacher.

Another thing that came to mind recently – and sending and taking starts with this – is to forgive and love yourself first, before you try to give things to others. If you hate yourself the taint of the hatred will devalue whatever you give to others, and make it hurt more too!

Strongly recommend “The Art of Happiness” too, wonderful gentle book.