Best Image Ever?

I found the following image while scouring the web one day. Has to be the funniest image manipulation I’ve seen in a long time…

Duck to Crocodile hybrid

Debian & Ubuntu - SSH Via an HTTP Proxy

So you’re sitting at work, and your much-loved VPS with hosting company X has gone down. You need to bring it back up, but you’re an hour away from getting to a PC.

Fear not, fellow hacker - SSH over an HTTP proxy is here! Well actually, it’s been here a while. Ahem.

Before you do this, I must stress that you should check with your network’s usage policy before continuing. You may be breaking your networks rules, and I cannot & will not be held responsible for anything that arrises from using these instructions. You are on your own.

Installing Corkscrew

To quote its package details in Debian & Ubuntu repositories, Corkscrew “is a simple tool to tunnel TCP connections through an HTTP proxy supporting the CONNECT method. It reads stdin and writes to stdout during the connection, just like netcat“. Put simply, it’s a way of sending traffic that would normally go via alternate means (say, over port 22), through a proxy server that may block the original routes.

We’ll need corkscrew, or a similar TCP tunnel package, to send the info via the proxy. Fire up a shell and execute the following:

sudo apt-get install corkscrew

This will install corkscrew. Don’t worry, it doesn’t run as a daemon, but instead on a per-connection basis (that is, it reads from stdin), so it’s not going to hog many resources. Once that’s done, we’ll configure ssh to use corkscrew instead of a direct connection.

If your HTTP proxy uses authentication, then you’ll need to tell it about the username and password to use. This is where the concept of ‘auth-file’ comes into play. All you have to do is put your username & password, separated by a colon, into a textfile. Once you’ve done this, you just have to tell corkscrew where to find the auth-file. Create a file called .corkscrew-auth in your home directory and place your username and password in the following format:

username:password

Save the file and get ready for the next bit… :)

Configuring ’ssh’ For Tunneling

Now we’ll tell ssh what to do when connecting to all or specific hosts. Open up ~/.ssh/config (that’s /home/yourusername/.ssh/config) in your favourite text editor (vim > *) and add the following lines:

Host *
ProxyCommand corkscrew proxyhostname proxyport %h %p /home/username/.corkscrew-auth

Note: replace proxyhostname and proxyport with the equivalents for your network.

Note: you won’t need to add the last section, ‘/home/username/.corkscrew-auth’, if your HTTP proxy doesn’t use authentication.

What we’ve just told ssh to do is for all hostnames (’Host *’), use the following proxy command to route the connection. The text after ProxyCommand is all specific to your HTTP tunneling software, except %h and %p which are ssh config variables for the hostname and port respectively.

This should work out of the box. It did so for me. Test it out in a shell by doing the following:

ssh somehost.com

I think you’ll be pleasantly surprised…Any issues, please post below and I’ll be happy to help out.

Cheers for reading,

Placid

Introducing My Photography

Over a month ago I deployed a photography section on my website. You could call it Placid Photography if you wanted. Anyhow, it’s a small gallery application I wrote in Django that provides a clean and simple interface to the photos hosted on my server that I’ve taken with my new Digital SLR camera, a Nikon D80. So, please visit beplacid.net/photography and enjoy the pictures. If you notice any bugs, or have any suggestions, please don’t hesitate to contact me.

Apache Axis Woes - Return Code (0)null

The latest project at work is using a service tier setup. We have the web front-end that’s using Struts 1.2 (yes, old!), Weblogic 9.2, Apache Axis 1.3, JSON & jQuery. The back-end web services are written in .Net (and how difficult it seems to be for developers to work in .Net). Things at least work, up until you receive very strange errors such as this:

java.lang.NullPointerException
at weblogic.xml.jaxp.ChainingEntityResolver.popEntityResolver(ChainingEntityResolver.java:75)
at weblogic.xml.jaxp.RegistryDocumentBuilder.setEntityResolver(RegistryDocumentBuilder.java:179)

and this:
AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (0)null
faultActor:
faultNode:
faultDetail:
{}:return code: 0

The worst thing about this error is that it’s completely non-descriptive. You can’t get a damn thing from your code (the WS call looks good; no connectivity errors). I spent in total 1 and a half days debugging this issue, and got nowhere. Google was returning red-herrings and forum posts with no solution and desperate coders saying ‘plz help me’. Painful stuff.

The fix as I see it, is to ensure the services are in sync. with the client.

  1. Make sure your web service is deployed correctly - the issue we discovered is that the client was sending extra objects that the service wasn’t expecting
  2. Regenerate your client - the client must be talking to the right methods and sending the correct object types. It looks like because the web service didn’t like our objects, it wasn’t returning a result (errors such as ‘There was an error while trying to serialize parameter X with data contract name Y’). The response therefore cannot be parsed, and you’ll get XML parsing errors caused by null pointers
  3. Check your logs; both server & client - we only found the true cause of our particular error because the service developer opened up the log directory in IIS. From that, I tail’d the log file when making a call and noticed the serialization errors.
  4. Don’t panic - yes it’s true, HHGTTG is right: panicking doesn’t help.

I first encountered this error well over a year ago when developing some web services myself. I’m no expert and I didn’t have the time to add logging (and indeed rebuild Axis) to Axis itself, but I’m sure the response returned from the service is totally unusable by the XML parser in your Application server and thus Axis itself.

I hope this helps someone. I spent so much time searching Google and pulling my hear out with no real solution…

asholl wormz

Oohhh the hilarities of MMORPGs:

asholl wormz - Anarchy Online

(Original image is from here)

You saw it here first ;P

ActiveSync 4.2 Error 85010014 - Solution

I recently upgraded my contract phone to the excellent Vario III/HTC TyTN II/Kaiser. I am extremely pleased with the phone, which has excellent build quality (including the built-in slide keyboard), great hardware such as the Qualcomm 7200 ARM Processor at 400 MHz, and a nifty compact design.

One of the things that I decided to get a PocketPC for was the synchronisation with my Work PC and specifically the Outlook Calendar. Unfortunately, the ActiveSync (version 4.2) software was giving me an error - 85010014 - every time I tried to sync the calendar. I had searched the web extensively but did not find a solution that worked for me. Thankfully, I found a way round it: don’t setup the sync to talk to Microsoft Exchange. Instead, follow these few steps to stop getting the error:

  1. Disconnect your device and delete it from ActiveSync (File-> Delete Mobile Device)
  2. Reconnect the device and let ActiveSync bring up the Setup Wizard. Click next until you reach the ‘Synchronization Options’ screen.
  3. Select all the ‘Information Type’ items you want
  4. To the right of the items that have ‘Microsoft Exchange’ as their source by default, select ‘Windows PC (This PC)’ instead of ‘Microsoft Exchange’. For me, this was just the Calendar.
  5. Complete the Wizard.
  6. Synchronize with your device
  7. Voila!

This worked for me, and continues to do so. I have meetings automatically synced to my device within seconds of them being added to my Calendar. Just what I wanted!

Note: this was done with ActiveSync 4.2, which can be downloaded here.

I hope that helps someone, as the lack of a sync’ing for a PocketPC renders one of its biggest features completely useless.

Why can’t a multi-billion dollar, international company such as Microsoft just get things right for once?

Goodbye 2007

Well, another year has passed. The older you get, the faster it goes. It’s not been a bad year considering last year started with the Mumps, which isn’t recommended at my age. 2007 began with a Skiing holiday in Bulgaria which was very fun and worthwhile. Skiing’s one thing I want to do more of. With the good comes the bad, however. There’s a few things I haven’t done that I really should have; such as pass LPIC1 & 2 (though I did study for it), start & complete SCWCD just as something for my CV, and last but certainly not least: pass my driving test!

So for 2008, I want to do these three things:

  • Complete LPIC 1 & 2
  • Pass my driving test
  • Code more!

So…goodbye 2007 and hello 2008. Thanks to everyone for a good year, and best of luck to all in the future! I’m off to the pub!