Crims can’t walk

Well, apparently it does. London’s Metropolitan Police force has decided to use London’s crime data in a way which is tangibly beneficial to Londoners, tourists; any interested party really. But this is more than just another government website. The subject matter is crime, always a political hot-potato, and increasing visibility of badly performing areas should (and this is a good thing) increase pressure on local government to tackle localised issues, reducing their ability to hide behind the banner of London. It has been known for some time, that small pockets within a metropolis are responsible for much of its crime.

For a body such as the Met Police service, this is a refreshingly ‘balls-in-the-wind’ attitude to take, but one which can only serve to benefit communities, and may even improve police/community relations with the increased open-ness.

Some might consider this to be another token political gesture. I hope it’s a sign of the future.

 train\r\n\r\nI an age of increasing political indifference to the views of \’le gens\’, it is good to see the UK government beginning to show, even dare I say it, encourage their population to make use of, and provide ways to, make the most of national data. Recent campaigns such as showusabetterway.co.uk is a genuine government initiative aimed at getting developers involved in making use of public data but more interestingly, to discover what kinds of data would be useful to make available. I believe this recent interest in public data is largely due to two sources. The awesome www.mysociety.org an organisation behind many new and useful resources such as notapathetic.com pledgebank.com/ hearfromyourmp.com/ fixmystreet.com/ (the list goes on) are, I believe, a huge influence here. Secondly the guardian newspaper have been running their free our data campaign for a some time now further helping the cause. The outcome can only be good. More freedom, more availability, more value from our data.

agile.jpg

I stubled across this interesting post today. It piqued my interest not because of any profound revelation in psychology or an aids cure; moreover, the simple reason why big companies often suck at getting stuff done. Shazam. There it is. Massively, glaringly even, obvious.

People work better in small groups. Simple.

When you forcibly gather people into larger ’societies’ such as the common workplace, you’re working against people’s natural strengths, and breakdown how (many) people work best.

1) Simple communication without overhead. - being able to talk rather than write email. Massively more efficient, effective, sensible; and often deals with issues immediately.

2) Coordination - Everyone knows what everyone’s doing. A byproduct of point 1.

3) Agility - Genuine speed in getting stuff done. A byproduct of 1 and 2.

So Agile practices in the software sense bring about this kind of step change in productivity, not through being a new misunderstood pseudo-science, but because they allow people to interact as they should, and place emphasis on the things humans do well. Funny then, the bigger the company, the more this ideology is orthogonal to the way they operate.

w
So it looks like the new iPhone is on the way; and with all the things we wanted, 3G Data, a GPS device. Is this then, the one device to rule them all? Apple i’m sure would like to have us think so. Like many folks I know, I have over time, gathered an annoying number of gadgets which now weigh me down, Phone, iPod, GPS device for the car, at one point, handheld GPS device etc. The phone saw me do away with a diary, as the iPod did to the walkman. So now one device for all. Only thing it’s missing then, for me, to be the killer device, full-sunday-roast-and-don’t-hold-the-mustard?

Openness.

A closed source, paid-for developer SDK? Apple are keeping a tight hold on their little IP gem here. We’ve been discussing the merits and issues with open source, indeed many readers of this blog. Some of the more commonly cited benefits of open source:

* Reliability
* Stability
* Cost
* Flexibility and Freedom
* Support and Accountability

Not things companies turn their noses up at. It seems then, to make good economic sense to open source such software. At work, we have decided to open source our SDKs. For us, like Apple, the SDK is an enabling tool; lowering the technical barrier to entry for our services. Admittedly Apple’s choice of closed source is unlikely to cause them problems as such. I believe they may be missing out on some great new content for the iPhone.

All well and good however, some people will only be concerned as to whether it will blend.

Playing around with python this week, we were set a puzzle based on the now infamous Fizz Buzz developer competence (achem) test. The rules were as follows:

Write a program that processes a list of numbers from 1 to 100. For each number, if the number is a multiple of 3, print “FIZZ”; if the number is a multiple of 5, print “BANG”; otherwise, print the number.

You are *NOT* allowed to use any *IF/ELSE* statements in your code. You can use the list-accessing ternary operator hack, but whilst I’ll accept your homework if you do, you’ll miss out on the prize (alcoholic), which goes to the most concise code (not including whitespace).

My colleague Kerry wrote an excellent post on how he achieved this. He diligently wrote a basic test, and then started towards the goal. I was a little less dilligent; and so, armed with google and a spare 40 minutes, I set about the task.

The outcome, while annoyingly *exactly* the same character length as Kerry’s solution, should be marginally more performant due to use of Tuples rather than lists, and a single print statement evaluation, rather than 100. Anyway, without further ado, here’s the code. I’d love people to tell me how to improve/reduce it!

print[('','','Buzz')[n%3]+('','','','','Fizz')[n%5] or n+1 for n in range(100)]

In the process however, I did learn a few cool things about Python. I’ve been warming to Python of late and am currently reading Mark Pilgrim’s excellent publication Dive into Python - highly recommended if you fancy dipping your proverbial toes.

Squid
Why is it that the US has so much good TV programming? Granted there’s plenty of crap out there too, but definitely a body of good stuff. Music too. Which is why I hate restrictions on accessibility. Pandora and a few others have blocked access to content from outside of the US. Luckily this is easily circumventable (is that a word?) with a little proxy magic.

Here’s what I did to get pandora working in the UK.

For this recipe you will need:
1 x Fresh linux server (I use Ubuntu server 7.10) Hosted in an authorised country for the content you want(easy for the US).
1 x Copy of squid proxy server.
5 x minutes.

What we’re going to do here is:

  • Install squid
  • Create a password file for basic authentication - squid support lots of other auth. system too
  • Set Squid to allow pass-through proxying for all connections which are authenticated
  • Deny all others

Download onto your server, a copy of Squid and install. If you’re on ubuntu, this will be easily acheived doing :
sudo apt-get install squid

If you’re not on ubuntu, the quickest way is probably to grab a binary package for your linux flavour and install.

By default, squid installs its config files to /etc/squid

Open up “squid.conf” in your favourite text editor.

Vi is usually fine for this job. if you look around line 2590 in the config file (“2590gg” in vi) you’ll see a section around authorisation rules. We’re going to be using basic authentication which is denoted as follows:


auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd-file

This specifies the authentication system for squid to use. Above I mentioned there are several others. If you take a look in /usr/lib/squid/ you’ll see others but i’ve stuck with basic auth here.

I chose to set a TTL for the credentials on my server. you can do the same but its not required.

auth_param basic credentialsttl 3 hour

Add the following lines below this:

acl nigel proxy_auth REQUIRED

http_access allow nigel
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

Here we are creating an ACL rule called nigel, specifying it is allowed access along with localhost, and denying all other connections.

Almost there.

Above you specified a password file to use at /etc/squid/passwd-file. Create the password file with htpasswd:

htpasswd -c passwd-file

You will be prompted for a password twice. Make one up.

Cool, you’re almost there.

Last step is to restart squid.

/etc/init.d/squid restart

Thats it, happy streaming!

So being a geek, I spent an interesting portion of my sunday afternoon hacking with the good folk from Google UK, some BT hackers Michael Mahemoff and some folk from MySpace Netlog, Hi5 and others.

As you’re probably aware, Google have made available a bit if software goodness called opensocial. It essentially allows you to talk to any implementing social networking (or similar) site using a set of standardised APIs. This means that the web gadget/app your write conforming to opensocial’s standard, will work (in any site which implements the opensocial API). “Cool” I hear you say. But what does this look like for me as an app developer? Well its actually pretty simple. Basically its this:

I wanted to see what this might look like from an ISV perspective. Enter Shindig.

So I set about getting this all setup. I checked out the Shindig source from subversion and compiled with the awesome maven tool. Deployed the resultant java WAR file to a JEE container (I used tomcat), hit it with the gadget xml, and hey presto - gadget renders. As an ISV, this means I can deploy my application to any number of social sites supporting the opensocial spec, hosting them on my infrastructure all by simply deploying a WAR file. Very nice.

So onto the application. The app spec is pretty easy to get going with also. In a few minutes simon had a simple app which grabbed a list of my friends from the host container, (in this case Hi5). I’ll certainly be keeping an eye on this webby goodness o’er the next few months.

Email

Why do we send emails? A simple means of passing information between one another; a proven, simple, understood means of information transfer. I guess email is so good at doing what to does, we begin to extend and use it in ways it wasn’t intended. File storage, file transfer, lightweight identity handle, the list is near endless. It would be nice to extend this a step further, and be able to refer to an email by way of a URI.

“Hey Joe, you remember that email i sent you?…” “…er no” “…this one http://mycorp.com/mail/2008/02/joe_at_hisdomain.com/122″. That would be handy. Sure you need security wrap around that but thats not a killer.

But then, not all people think this way.

Some would have you believe, that email should never occupy more than half of your mailbox. Some would like you to take extraordinary measures to prevent losing attachments or old mails. Some would have you believe they’re “helping” you by moving your mail to an archive such that you’re only able to retrieve the first 256 characters of the mail, and completely losing attachments.

Some people, friends, are idiots.

I would add, a caveat to this could be a poor implementation of this product.

A free, simple solution to personal email is offered by google. As many of you will know, their Gmail service, offers 6+GB of mail storage, all indexed, optional mail tagging available, which mean you practically never have to lose your email.

So why is this such a difficult problem for the enterprise? Sure, it can be expensive to offer each employee this volume of storage, esp. if you have to host the email data on your own servers. Even still, this is a solved problem, and for the majority of businesses, utility computing makes disk almost free. Services like Amazon’s awesome S3 service for example.

Lets see the enterprise take a new stance on this and figure it out. download nokia ringtones,download info nokia remember ringtones,download ringtones for all nokia phonefree real ringtones for alltelcell cingular free phone ringtonesdownload free maker ringtoneschristian free music ringtones7100i blackberry ringtonessamsung polyphonic ringtonesfree latest bollywood ringtonesreal ringtones wwemusic nextel ringtones1100 compositor nokia peliculas ringtones,nokia 1100 ringtones,ringtones gratis nokia 11002366i nokia ringtonesringtones for verizon wireless get it now,verizon get it now ringtonesringtones for lg wireless phone,lg phone ringtones100 free virgin mobile ringtonesverizon cell phone ringtones,ringtones for lg verizon cell phone100 virgin mobile ringtones,100 mobile ringtones virginalltel free phone ringtonesfree kyocera ringtonesfunny free mp3 ringtones,mp3 ringtones,free mp3 mobile ringtonesno checking account required payday loan,no checking account payday loan,account checking loan no paydaypayday loan on lineez payday loancheap company loan payday,company loan payday,how to start payday loan companyten dollar payday loanno credit payday loan,credit dollar loan no payday ten,credit loan no paydayinstant loan payday,approval fax instant loan payday,instant fax payday loaneasy payday loanfaxless loan payday,faxless payday loan with instant approval,faxless and paperless payday loanmoney tree payday loanline loan payday,payday loan on lineonline payday cash loanonline payday loan applicationameriloan loan paydaypayday loan best rate,best payday loan site,best loan payday30 day payday loanadvance cash loan loan paydayadvance cash loan payday software? ?no faxing payday loanez money payday loancheap loan payday,cheap loan long payday termcash til payday loanconsolidate payday loan debt,consolidate debt loan paydayall payday loan in canada only,canada loan manitoba payday winnipeg,canada loan paydaycash loan payday quickloan payday store,alabama loan payday store,payday loan store in chicagogeorgia in loan paydayfax loan no payday requiredcheap payday loanloan money payday tree

I’m back!

05Feb08

Wooohoo - after a week or so of DNS wierdness my blog is back online.

Better write something.

hmmm.

After a few minutes of messing around I found it was actually rather simple to perform basic manipulation of images with Rmagick and Ruby. At work, we’d been looking for a simple way of allowing folk to upload an image, pop it into a BLOB in postgres and generate a small thumbnail. So here’s a brief rundown of what I did (btw: i’m assuming your modifying an existing model to store the image):

Install Rmagick
(i’m currently running Vista (not for long) and this is the best for windows as you’ll struggle to find win32 binaries for the other ruby image mungers). Have a look here for the latest Rmagick.

Prepare your Database.
Do a migration to allow you to store some meta-data and the actual image data. I did something like this:


class AddImageData < ActiveRecord::Migration
def self.up
add_column :foo, :image_content_type, :string
add_column :foo, :image_filename, :string
add_column :foo, :image_binary_data, :binary
add_column :foo, :image_thumb_binary_data, :binary
end

def self.down
remove_column :foo, :image_content_type
remove_column :foo, :image_filename
remove_column :foo, :image_binary_data
remove_column :foo, :image_thumb_binary_data, :binary
end
end

Run a rake db:migrate to prepare your database.

Write some tests to validate your model class is actually going to do something with the image data. I wrote a couple of simple tests to prove our accessor method below “uploaded_picture=” gets hit when i create a new “Foo”, and that the image_data fields are read into the model correctly.

Fix up, Look sharp.
Now fix up your model to do something with the new image. I did this (not much code for what you get!):


def uploaded_picture= image_data
if image_data
img_orig = Magick::Image.from_blob image_data.read
thumb = img_orig.first.scale(200, 200)

self.image_filename = base_part_of(image_data.original_filename)
self.image_content_type = image_data.content_type.chomp
self.image_binary_data = img_orig.first.to_blob
self.image_thumb_binary_data = thumb.to_blob
end
end

def base_part_of(file_name)
File.basename(file_name).gsub(/[^\w._-]/,'')
end

The code has eyes
Now modify your view to accept a file upload.
Note that you need to set :html => {:multipart => true} for the
tag or you’re in for a long and fruitless evening.

Add this to your form where “f” is the form in scope.

<%= f.file_field :uploaded_picture, :label => “Image” %>

And you’re done. Hope this saves you some time! PS - sorry about the screwy CSS. I’m using a crufty wordpress theme. Will fix when i have some time.

Samaritan

One of my first posts on this blog described the tendency of humans to behave in a manner which is ultimately self-serving. We consider the interests of ourselves over others. I called this selfishness, with a note that one should disregard the negative connotations of the word.

Months later, browsing the excellent TED talk archives I have come across Daniel Goleman’s talk “Why aren’t we all good samaritans“; a promenant psychologist, essentially supporting the theory (albeit indirectly) that we do principally, act to serve ourselves or our emotional need. Even, or rather especially in ’selfless’ acts such as giving to charity; we get an emotional ‘hit’ by doing so. Yannis made some interesting points also supported in this talk. Check it here.

My friend and colleague Tim posted a good recipe for warm spicy winter apple juice so i thought i’d post one of my faves. Its actually a French recipe so there are many other permutations of this available.

So, you need 2 medium/large duck breasts (skin on)

  • 1 Medium orange
  • 1/2 (350ml approx) red wine (Medoc or Malbec grape wines are good but whatever you’ve got)
  • 2 Cloves garlic
  • Half Kilo Baby new potatoes
  • 150ml fresh double cream
  • 15g Fresh chives
  • Sprig of Thyme
  • 10g Cornflour
  • 50g butter
  • Take the duck breasts and score the fatty side with a sharp knife in a sort of lattice pattern. Grate the zest of the orange into a bowl, then add the orange juice. Finely chop the garlic and add to the orange bowl, along with the red wine and the thyme sprig. Place the duck breasts into the bowl so the meaty side is submerged. If you’ve got time, leave this to marinade for 3 hours or so, if not, leave it as long as you can.

    Boil some water and add your potatoes. Depending on their size, they will need approx 10-12 minutes for smallish (4cm diameter) spuds. Once the potatoes are on, heat a frying pan on a high heat, with a very small amount of oil in. When the pan is hot, place the duck breasts in the pan fatty side down to sear the surface. After a minute or two the fatty side will have a lovely golden brown colour. You may wish to pour some of the fat out here if there’s a lot (save it for making roasties!). Turn the breasts and sear the meaty side for a minute too. This seals the meat and keeps the juices in. Turn the heat down lower now, and pour in your marinade (wine & orange mix). Allow this to reduce on a low heat (such that the liquid is not boiling). Once the liquid has reduced down, the duck and potatoes will be ready.

    Drain the potatoes and place back in the pan with the butter on a medium/high heat. Add seasoning to taste here. Fry the potatoes in the butter, rolling them round the pan so they don’t burn.

    Take the duck breasts from the reduction jus and place on warmed plates, or in the oven on gas mark 1. Mix the cornflour with a small amount of cold water and mix. Add this to the reduction jus along with the cream.

    Place duck and potatoes on plates adding the jus as desired. Garnish with Chives.

    Fin.

    No DRM

    My feed-reader picked up an interesting snippet of info the other day. Sony BMG, (Sony and BMG combined music arm) are to drop DRM protection on all music distributed from their back catalogue. Fantastic news then for music lovers everywhere! As is so often the case, now a major label has annouced this bold step (and yes it is bold for the music industry), others will surely follow suit.

    Does this mean that Sony have rethought their strategy with regard to online sales, or is it merely acceptance of the inevitable? Either way, I admire the thought behind this, and the lead they have taken, especially given sony’s dreadful record in bygone days for hounding down all those “evil pirates” when in fact, it was the DRM software causing the problem.

    Anyway, let bygones be bygones. I can’t help but think there’s some character like PSD jumping for joy somewhere inside Sony’s corporate wall, in fact i’m sure of it.

    VRM VRM!

    29Dec07

    Seeing more and more sites cropping up along the lines of getsatisfaction.com. This is a good thing. Also sites like http://www.gigpark.com/ which invite people to build genuine community driven recommendations of businesses. It seems VRM then, is inadvertently gaining ground. Cue thoughts of “path of least resistance”…

    Feels like the Cluetrain Manifesto is becoming a self-fulfulling prophecy! About time too. Isn’t reality refreshing!

    So LeWeb3 fourth edition, ‘07 draws to a close and leaves me with a confused set of emotions. As I sit in a cafe at Gare du Nord, I am feeling a strange combination of excitement, concern, happiness, amazement and anger.

    I will start positively. Although entirely subjective, I think the conference succeeded in bringing some interesting, bright and talented minds together, putting some on the stage, others on irc.freenode.net#leweb3 and a few more on twitter, and got people talking about some of the new toys, problems, issues, hopes and fears of The Internet. I state the Internet as this was not all about The Web as the title indicated.

    Keeping this brief (as my train’s coming soon), I shall spare you the usual summative highlights lowlights foo and say more what I think overall. The speakers in attendance were generally excellent, the likes of Kevin Rose of Digg Pownce and others, Evan Williams(twitter), my usual faves, JP and doc along with the idiosyncratic but amazing french designer Phillippe Starck were among the better ones. Speaking of idiosyncracies, it did seem an odd setup. Odd insofar as being likable to a “Friends of Loic le Meur” gathering. Some talks were cut short in light of earlier overrunnings despite some of those being some of the more salient issues (VRM with Doc Searls comes to mind). Particular sessions were wildly off topic, much to the dismay of the irc’ers and twitter clan. My colleague Robbie asked a very valid question during this session, to which the speaker panel basically sidestepped (read more here). At least the food left no sour tastes in the mouth, well done there.

    Overall, hmmm. I’m left wanting more of some, less of other and better overall, apart from the company. I met some brilliant, interesting people here and hope to keep in touch with new friends and look forward to new relations. Now then, wheres that train…


    Me

    me Nigel Pepper
    About me.


    Add to Technorati Favorites

    My favourite blog posts

    My Swarm

    twitter

    flickr

      Tomatoes!Fish for DinnerMmmCD stackinAlphabetising a CD CollectionOlivia's FootHairy LegCode

      last.fm


    dopplr