Custom linux service at boot

So you’ve created a service in Linux, written a start/stop script for it, stored it in /etc/init.d/ and now you want it to actually run on boot/restart. This little line of code at a root terminal will do the trick for you.

update-rc.d <script> defaults 98 02

The <script> should be replaced with the file name of your start/stop script in /etc/init.d/ the 98 ensures it’s (likely) to be the last script to start and the 02 ensures it’s (likely) to be the first to stop.

Comments    

Stalling File Transfer Over VPN

The other day I had cause to allow someone to access their corporate VPN over my home internet connection. After I had configured the appropriate pass-through settings for the IP address that my DHCP server had allocated their laptop they were able to connect easily. One issue remained however; whenever they checked a file out of sharepoint that was over 250Kb or so, the file transfer to their machine would stall and consequently crash the browser.

Google threw up all sorts of possibilities but the more things we tried (and that failed) the more I couldn’t escape from the idea that it must be some network related issue. I got to thinking about the nature of VPN and how there is an initial connection and then a large stream of UDP packets over the tunnel for the data transfer. That’s when a light bulb switched on – I’d seen something like that before in my Draytek router settings.

Draytek have a nice selection of anti denial of service features which I have activated to protect my network. Some of these concern certain types of flood defense; where a count of packets is maintained and if it exceeds a certain threshold then the connection will be dropped for a period of time. This would result in the appearance of a stall for any file transfer caught up in the melé. Bingo!

The culprit setting is shown in the screen shot below, “Enable UDP flood defense”. Originally this was set to 150, I had to set it to 1000 in order to eliminate that VPN issue.

Draytek DoS UDP Settings Screenshot

It’s worth discussing why the number has to be so high for my fix and why it may not need to be so high for you. Most home connections over VPN end up being below 5Mbit or so with the corporate end point on the other hand being capable of 100Mbit. This results in the overall speed obviously being tied to your 5Mbit speed. In my case I use the FTTC technology and thus have speeds up to 80Mbit. This means I can transfer many more packets per second than most people on home connections so it is likely that you won’t have to go so high as 1000 to get the desired result in the Draytek settings.

I hope this helps someone out, feel free to get in touch with me if you have any questions.

Comments (4)    

Photos too dark

I’ve been told by a number of people in recent times and have received a number of e-mails stating that the photos on my website are too dark, somewhat under exposed. This has always puzzled me as while the photos do look a little on the dark side, the exposure is almost always set correctly based on my camera’s light meter when I’m composing shots. This has almost made me believe that the light meter was faulty but looking at the photos on the screen on the back of the camera I can see that this is not the case. Time to delve deeper.

In order to publish my photos to the web I have to extract image data from the RAW files my camera generates and compress into a JPEG file that can be delivered to and opened by a web browser. To to this I make use of dcraw, a nifty little application authored by Dave Coffin. This will pass data out from the RAW file to be collected on stdout by a program such as cjpeg.

As I like to publish exactly what my camera has stored to the file (with a little compression for portability) I don’t use many of the options on dcraw, just invoking the ones that read the values from the file it’s self and use those. Looking down at the parameter list I suddenly wondered if perhaps I’d mistakenly used the wrong parameter somewhere, so I started to check each one I’d used against the documentation.

Everything checked out apart from one very small anomaly; -w was documented but -W was not. The documentation states that -w tells dcraw to use the white balance value stored in the RAW file when processing which is what I wanted but -W seemingly did nothing except it threw no errors when used so must have some function.

Plunging deeper into the documentation I found the bombshell I was looking for; -W is used for switching off the exposure compensation value contained within the file! I ran a quick test and changed to lower case while decoding a photo I’d taken recently and the effect was perfect, the correct brightness and also the correct white balance (it hadn’t been far wrong but was much better now).

I’ve now updated my script that I use to call dcraw to invoke the correct parameters and hopefully dark photos will be a thing of the past on my website. The thought of having to re-decode some 3000 odd photos that have already been uploaded doesn’t fill me with joy though…

Comments (5)    

Test

Test

Kind regards,


Kieran O’Shea BSc (Hons) MBCS

http://www.kieranoshea.com

kieran@kieranoshea.com
+44 (0)1133 508345

Comments    

Akismet for Zenphoto Fixed

As a user of Zenphoto for my gallery of photographs I’m pleased to report that I’ve corrected an issue with the long standing Akismet plugin for the platform allowing it to work with the latest version of the application, thus restoring anti-spam functionality to comment forms on both my sites and any others that care to use the plugin.

Rather than re-post all the details here you can follow the discussion and download the fix from the Zenphoto forums.

Comments    

Anti-Spam Effectiveness

What website are you looking at? Sounds a simple enough question right? Well for a human maybe but perhaps not for a CAPTCHA reading online bot. A problem that’s plagued bloggers and forum administrators for years is how to stay ahead of the comment/post spam that invariably results from putting one of these sites online.

The solution until about a year ago has been to go for a centralised solution like Akismet or make your CAPTCHA ever increasingly harder to read and thus harder to crack. Unfortunately the latter has simply increased the number of frustrated users resorting to e-mail to ask for access or giving up altogether. Akismet has stayed ahead of the curve and for one-off comments on blogs and other types of media has proved invaluable. For forums however there isn’t really a reliable connection between most forum systems and Akismet and administrators have been left wondering what to replace their ageing, difficult to read and fundamentally ineffective CAPTCHAs with.

Welcome the Q&A. While this concept has been around for a while, Q&A really comes into it’s own when you factor in randomisation. If a particular style of CAPTCHA is in use by many sites then it’s well worth a spammer trying to crack it as they reap large rewards. Custom solutions on the other hand have the advantage that unless you run a huge site like BBC News, they’re not going to be worth cracking as there are easier rewards to be reaped elsewhere. While you could use a custom CAPTCHA this requires some effort and you’ll probably end up re-using someone else’s code which defeats the uniqueness objective. This is when we resort to the simple question, unique to every website. Where am I? Who is my admin?

Having implemented such unique questions to all of my forums recently I can report a resounding success. No automated registrations leaving just the handful of spamming manual ones which are easy to weed out of an early morning. The big bonus here is legit users find it a doddle to register as they either know by heart or can easily look up the answer. I also now have the slightly tangential advantage that if I were to start getting automated registrations again then my sites may well have become as popular as BBC News which would certainly bring a smile to the face.

Comments    

Jack Kelly’s Sailing Dream

A friend of mine, Jack Kelly, whom I met at Leeds University while studying in the School of Computing, has taken it upon himself to join the crew of a tall ship, Windeward Bound, for a 6 month stretch. As a fellow sailor I was delighted to find that he has decided to write a blog about his experiences while on board and I’ve begun avidly following his updates. Jack, I wish you all the best for your travels on the high seas!

Comments    

Final Sail Of The Year

Today saw me return from my last sailing trip of the year before hanging up my oilies and hunkering down out of the cold for the winter. As luck would have it we couldn’t have had a better weekend for such a sail and despite the lower than preferred wind speeds we completed our overnight race to the French port of Cherbourg and returned to Gosport the following night in high spirits and with somewhat windswept and sun tanned faces!

I’ve included below a couple of choice photos I snapped when I got the chance. First up is the actual start of the race, dead centre of the picture you can just make out the starting box on the shoreline and of course the other boats in the fleet who have crossed the line or who are about to. The second is the sun drenched terrace bar in Cherbourg where the tired but satisfied race participants were conversing and enjoying a glass of Merlot (or three!)

Start Line

JOG Drinks Party

Comments    

On London Driving

These days I’m often in London and despite the generally held opinion that London is the last place in the world you’d want a car, I’m usually behind the wheel on my visits. While my motivations for picking up the car keys are largely financial as well as a dash of convenience – why spend twice the cost of the fuel on a train when doing so would result in a massive hike to the tube as well as a change at Baker Street which is never an enjoyable experience – I’ve found my driving time has allowed me to make some rather amusing and somewhat tongue in cheek observations on what it is to be a London driver.

Firstly, space between cars. In conventional driving it is considered to be rather bad form to be up another drivers boot lid however in London the opposite is true. This is because a driver who leaves too much space is making the queue longer and has, de-facto, prevented a person further behind getting out at the lights, usually resulting in much honking of horns.

Traffic lights, while most certainly to be obeyed at all times (many have cameras to prevent red light jumping) are an opportunity for position posturing. In an effort to reduce traffic jams at junctions, London roads widen from one lane to anywhere between two and four lanes. While this sounds like a good idea, what you don’t realise until being right up at a set is that the road narrows once again almost immediately on the other side of the junction, resulting in a massive bun fight for “head of the queue” in the single file line of traffic that is to follow. Drivers at the white line by the lights (affectionately known as the starting line by initiated city motorists) vehicle occupants glare at each other in defiance through the quarter-light and twiddle with their hi-fi, not for a second however taking their eyes from that red glow up above. Cars are always to be left in gear, clutch point a mere millimetre away from taking the bite, in readiness at a chance to take the leading position in the head of the queue. Even if you’re not at the front, there’s no reason why glory can’t still be yours – you may have a Subaru in front of you and someone with a dodgy clutch to his left – second place is surely in reach. The fact that this whole exercise will release more CO2 than a 20 mile motorway journey and is to be repeated in another 100 yards at the next set of lights is immaterial. Participation became mandatory the moment your car crossed the M25.

Multiple carriageways are surprisingly common and present plenty of opportunity for vehicular shenanigans. Filters to join and exit may be left or right which presents ample opportunity for sat-nav engrossed motorists to swerve violently across 3 lanes to their goal. Speed is also an important factor. While heavily populated with fixed cameras, the road regular will know that average speeds are usually below the legal limit and so seek to maximise their speed by switching lanes (ignoring all pretence of the rule concerning not overtaking on the inside) to increase their average on each 100yd stretch by 1mph or perhaps even more. The switching of lanes in this way is an art, with success usually being measured by how many car lengths you gain on vehicles in your general vicinity. No distance between your own rear bumper and the front of the car behind and to the side is too small to prevent pulling out and zipping past the vehicle in front on either side. Indicating is usually considered only as an after thought and thus is rarely used by regular London drivers. While some motorists may let others get away with such daring over/undertaking manoeuvres this is frowned upon and a good thumping of the horn, a glare and full beam on the headlamps for the next half mile is usually practised, even if many attempts are made at apology.

Traffic jams are a common occurrence and a driver has few options, with the ones that are available being varied in success rate. Simplest is to sit tight, roll the windows down, blare out some music in an anti-social way and pretend like a central London traffic jam is *the* place to be and that you really wouldn’t rather be anywhere else. While not helping your forward progress, this increases your public visibility for those you’ll never see again and there is always the chance that any alternative route will be more snarled than yours. Don’t make the mistake of thinking that if one bridge is clogged, heading up/down river and crossing at another will get you through. In the time it has taken you to think that, over 1000 other motorists have thought the same and the other crossing option is now snarled also. This is not to say that taking an alternative route doesn’t have some appeal. There’s the option of the crazy u-turn in front of a bus followed by a rapid darting down residential streets, snaking your way left and right in an easterly or westerly direction until you hit the next main road and hope that you can somehow bypass the jam you were previously in. Most people have a great time for the first five minutes until they realise they are lost. In fact when parking, the car you’ve just seen drive past for the fifth time is probably just such a motorist. Take no time for pity for you would never do such a thing, at least that’s what you should tell yourself when you next wind up an hour late and on the wrong side of the city because you were “avoiding traffic”.

Cyclists own all roads inside of the M25. This is regularly demonstrated by their passing through red lights, cutting across your path when you have the right of way and damaging your vehicle when you are stationary in traffic without stopping or making any effort at an apology.

Parking, compared with all that moving about, should be easier but that’s rarely the case, especially in areas of free parking. The motorist in search of free parking is akin to a gannet, circling, waiting for the opportunity to get their share. If you’ve been driving round for five minutes looking for a spot, don’t kid yourself that the car in front is just using the road as a means to an end. They’ll surely take the parking space that you’ve just seen free up ahead. Parking space search fatigue is common. This is where you spot something that looks like a space, but actually you’d have to be really rather lucky to park a wheelie bin in the gap. You attempt to park anyway, denting your own bumper and cracking someone else’s number plate in the process. Circling resumes. Serious fatigue is when you try the same “only fit for a wheelie bin” space again later, this time cracking your headlamp and inflicting further damage to the other individual’s vehicle. When you finally do park and walk off on your business, don’t congratulate yourself too much. Even if you’ve parked perfectly you’ll almost certainly have a parking ticket for poor parking or have had someone else dent your car while trying to get into the space in front or behind.

When all is said and done, far be it from me to discourage the budding London driver. Remember all this excitement pales into insignificance when you consider some other cities such as Milan where any attempt to articulate rules is simply replaced by carrying out the desired action anyway and uttering the words Mi Scusi!

Comments (1)    

Daily Blogging

Many years ago (and yes I do mean years) I used to find time during the year to write an average of one blog article per day. As is quite self evident from navigating through the blog archive I’ve not been achieving this posting rate for quite some considerable time.

I used to explain away momentary relapses in blogging by stating that I was waiting for something good to say and a poll on my website affirmed that this was the correct thing to do with over half of respondents preferring to wait for a post to appear that they wanted to read rather than wading through mindless drivel. That being said, I can hardly do myself any justice by inferring that I have had little useful to say while posting has been more sparse. As friends and family with whom I’ve dined out over the past few years will confirm, I’ve always had something to say about most things going on in the world!

Two years ago at WordCamp I explained to a packed conference room some tips and tricks for filling your blog by contributing to it’s content via posts made on other social sites thus keeping your personal web space up to date with your life but without having to make a concious effort to blog. While I’ll not stop doing this as the varied content is a nice touch (especially with the photos) I’ve come to realise that something is wrong with relying on this approach to fill the pages – it lacks reason and direction. Essentially, I’d forgotten why I turned to blogging in the first place.

I turned my previously static HTML based website into a dynamic blog back in 2005 shortly after I’d joined the University of Leeds School of Computing. As my life was in a fair state of turmoil at the time it seemed a logical thing to do, to have a place online where updates could be frequent and varied and not limited to a specific structure. Once I’d gotten settled at the SoC however, I found that my blogs settled down too. I found focus and energy in my work and my blogs were both a personal reflection on this fact for myself and a window onto it for the wider world. Essentially blogging was both an affirmation of and a driving force behind my positivity.

OK, so strong stuff then. Well perhaps not. I’ve realised recently that I’ve got into a bit of a habit of dwelling for too long on the things that go wrong and not taking enough positivity out of the the things that go well. While out walking the other day in the evening sunshine I was thinking about ways to better channel that “get up and go” attitude and I remembered my blog – how a tough day in the computer labs would soon be forgotten by passing amused comment on the party from the previous evening or by reflecting on a trip I had planned in a few weeks time.

Who could say no to an opportunity for an outlet for forward thinking? While I can’t promise I’ll manage to get a post up every day in this new concerted effort as the post title suggests, I can offer assurances that I’ll look to be tending towards 30 posts in a month in the not too distant future. Article ideas on a postcard….

Comments (5)    

Next entries » | « Previous entries