Jan 172014
 
If you’re like me and want your smiley face plastered all over your Lync conversations, then you may have found that Lync annoyingly makes you host your own picture:
 

lync

 
I found this very frustrating until I realized I had a LinkedIn account with a publicly-visible profile picture I could link to:
 

linkedin

 

To do this yourself

 
1. Update your linked-in picture (if need be)
 
2. Ensure your picture is publicly available
  • Account & Settings -> Privacy & Settings -> Change your profile photo & visibility
  • Ensure In addition to users I message, my profile photo is visible to… is set to Everyone
3. View your public profile
  • Click Profile
  • Click the link under your picture to view your public profile
  • Right-click your profile picture on your public profile

4. Copy the image URL

  • Right-click your profile picture on your public profile
  • Select “Copy image URL” in Chrome
  • Select “Copy” in IE
5. Set your Lync picture URL
  • Open Lync
  • Click your profile picture
  • Select Show a picture from a web address (as in the screenshot above)
  • Paste in the URL
  • Click OK
So now you’ve linked your Lync picture to a link to your LinkedIn picture… Easy!
Jul 092013
 

After being inspired by Veronique’s and Dave’s similar posts, I’ve put together some things about me that you might not know:

1. I can’t draw

If you want an interface sketched then everything’s fine, but anything that doesn’t involve a ruler turns into a wiggly horrifying mess. This put a slight dampener on my childhood dream of becoming an artist: My teenage sketches prompted my art teacher to ask if I was drawing with the correct hand.

Similarly, my handwriting is so bad it makes my eyes water to read it.

2. I have a very varied music taste

I listen to everything from Folk to Industrial, with a particular liking for Indie. Apparently this is a family trait, and led to me and my mum going to see Rammstein in concert together (twice).

I have my limits, though. I’m afraid I’m not a Bassline Junkie.

3. I’m doing a cycle challenge

I’ve babbled on about it before, but I couldn’t pass up another opportunity. :) I’m cycling from London to Brussels (230 miles) in September to raise money for The Alzheimer’s Society: How to kill a software developer: 2000 miles of cycling

At the moment that means spending most of my spare cash on cycle parts, spending most of each Saturday riding around the Cotswolds, and getting into work looking like… well, like I’ve cycled 15 miles in blazing sunshine, to be honest: Sweaty, smelly, and pink as a flamingo.

4. I was a manager for a year

It doesn’t sound very interesting, but it was probably one of the most important years in my career. I learned more in that year than in any other year to date:

  • How software projects are seen and initiated in senior management
  • How being in middle-management is like being between a rock and a hard place
  • How making a decision (even the wrong one) can save days of discussions and delays
  • Responsibility should be taken, not given: You make the boundaries of your role

5. Evernote is my brain extension

I use Evernote so much it’s ridiculous. To date I have (including but not limited to):

  • 49 blog article ideas/notes/drafts
  • 20 software specs (unfinished)
  • 7 monthly logs (“Dear diary…”)
  • 20 unfinished (often unstarted) short stories
  • An entire fictional universe (ready to be made into a game)

6. I can’t stop using analogies

I use analogies like a cow produces gas: Unexpectedly frequently and often accidentally. If I’m not using an analogy to explain something  then I’m probably telling a related story instead.

For example, just recently I described a software problem as “… like a trap someone set in the Amazon jungle: Whatever’s inside is going ‘Quack!’, but no-one wants to believe it’s a duck”.

7. I always have at least 2 side-projects running

For some reason work, a 1-year-old daughter, and a high-maintenance wife (no offense meant, high-maintenance-wife) is not enough to keep me sufficiently stressed, so I end up doing all kinds of side-projects. I even have a Trello list to help me keep track of them.

Currently I have the cycle challenge (mentioned above) and a Jobsheet-tracking system I made for my father-in-law’s company, which I’m converting into something more widely useful.

8. Believe that regret and anger are useful tools

Here on in is a bit preachy, so you may want to bail now. ;)

When I’ve done something I regret, I use it to push me to do something constructive with it:

  1. Set it right as best I can: Usually an apology or at least an even-handed explanation
  2. Avoid it in future: I try to understand how it came about and how it can be avoided or better-handled
  3. Don’t wallow: Every time I feel regret from that point on is just a reinforcement of my conclusions in 2.

If 1. and 2. don’t apply, then it isn’t regret: It’s usually something else disguised as regret.

When I’m angry I tend to dig through it to find out what’s actually bugging me: I might be angry at an inconsiderate driver, but the real reason is that I’m running late because I stayed in bed too long.

Then I try to do something constructive with it: This could be refactoring an inflexible code module or trying to figure out a better route to work. Occasionally the most constructive action is just to let the anger go, making the world a slightly better place by not passing it on.

9. I’m a Pacifist

Mostly through luck and partly through patience I’ve never hit someone in anger. Well, I shoved a couple of people when I was a teenager, but that’s probably about it.

10. I’m an Agnostic

Unfortunately faith has never struck a chord with me. I have nothing against anyone that holds faith of any form, as long as they use it to drive themselves to be better people.

More controversially, I see Atheism as a faith too: Humanity as a whole doesn’t even understand how little it knows about the universe, so how can anyone say there’s enough evidence to disprove the existence of anything?

 Posted by at 2:56 pm  Tagged with:
Apr 222013
 

Ever see one of those charity events and think “Hey, I could do that. No problem.” Then you think about it a bit harder and realise that it’s probably not a very good idea at all?

Well, I saw a charity ride raising money for the Alzheimer’s Society and thought “Hey, I cycle 4 miles to work, I could cycle 230 miles from London to Brussels. No problem.” Then something very odd happened: My wife (destroyer of fads and disapprover of good ideas) said “Yes, you probably could.” to the surprise and shock of all involved.

230 miles? That’s not too bad?

Charlton Abbot

It works out at 75 miles each day, split over 3 days. But average folk like myself haven’t a chance in hell of getting up even the first big hill without training. 2000 miles of training, to be exact.

My nice 4 mile commute into work is now a grinding 10 mile loop of hills and back roads, which will get longer and longer until the challenge itself in September, by which point I’ll be regularly doing a commute of 25 miles and a weekend ride of 70 miles!So every weekend I’ve been panting, sweating, and wheezing dozens of miles across the Gloucestershire countryside, in the hope that at some point I’ll miraculously turn into Bradley Wiggins.

But… Why?

I’ve asked myself that more than once, believe me. To be honest there are two main reasons: A selfless one and a selfish one.

1. With one in three people over 65 developing dementia, it’s likely we’ll all know someone effected by this awful condition. The Alzheimer’s Society help people with Alzheimer’s and dementia, while also funding research to prevent it in future.

2. It’s been one of my life’s aspirations to do such an event, so I thought I’d get off my bottom and do it.

Where do I donate?

The challenge’s minimum fundraising target is £1250, half of which is due in June. So any help towards that would be greatly appreciated by both me and the charity! Here is my page on Just Giving:Me

http://www.justgiving.com/Stuart-Pegg

If you live in the UK you can also donate by texting “STUU60 £2″ to 70070

You can watch and/or laugh at my training progress on RunKeeper:

http://runkeeper.com/user/foriamstu/profile

Thanks for reading!

Mar 192013
 

Reposted from http://sharepoint-community.net:

Even the best of friends grow apart. Sometimes your interests change and you slowly lose contact with each other. Other times the situation is more one-sided: One friend moves on to new things, leaving the other one wondering what happened.

Well guys, SharePoint has stopped answering our calls and doesn’t want to hang out with us any more. If you still think SharePoint’s your best buddy, read the signs for yourself:

You’re not invited to parties

Back in 2007 SharePoint was all “Woo! Yeah! Get yourself down here!” with farm solutions running free all over the house.

By 2010 things had started to change. SharePoint had started to hang out with it’s Power Users more. You could still come to most of the parties, but now SharePoint was asking you: “Please don’t do that thing you do. Y’know ‘code’. Unless it’s in the sandbox out back.”

Now with 2013′s app model it’s gotten even more awkward. SharePoint’s moved on from the Power Users and is in with the End User crowd: “Code? Yuk. Go do that in your own house.” The preferred method is for you to run code on your own servers, displaying the information via JavaScript.

You don’t have anything in common

When 2010 made it easier to publish code, it seemed like you were both enjoying yourselves. But SharePoint was growing restless. With it’s plans to go hosted, it started to make it more and more awkward to do things together.

At first it was making the Office 365 authentication painfully complex, leaving it to you to chase after them: “Oh, yeah. I changed my e-mail address to avoid spammers.”

Then suddenly 2013 just doesn’t support installing SharePoint for local development (see the Note): Exiling us back to the days of remote debugging: “Well, send me a letter or whatever.”

So where does that leave us?

It means if we want to stay friends with SharePoint we’re going to make all the effort and do it on their terms. They’d prefer it if they hosted nowadays, where we can code only JavaScript and HTML (if we ask nicely) and leave that old-fashioned server code thing at home.

But it’s OK because somewhere deep down SharePoint is still our friend… Right?

Sep 292012
 

todo

Want to be really productive, but you’re not really keen on doing any actual work? Here are some tips on how to waste your time on productivity, rather than actually getting anything done.

 

Research productivity

Spend a while researching different productivity methods. Like the look of one? Do a little research into its origins.

Wikipedia is a great resource for this kind of unwork: A few minutes in and you’re already reading an article about the most notable features of an amusingly named town your new method’s inventor grew up in.

Once you’re satisfied with the inventor’s environment during his or her upbringing, you should do some research into the method itself. Does it have many rave reviews from productivity blogs? Has it been mentioned by any successful startup founders?

 

Try a new productivity method

Get good and hyped up about your new productivity method: Once this system is implemented it’ll be well worth the investment of time.

Methods that include some form of physical prop are by far the best kind at this stage. I mean, how can you be expected to get anything done before your method-tailored timer/notebook/guide has been delivered? Don’t worry about the price; the results will be life-changing, after all… Once you get round to ordering it.

Methods that are centred around a software package are OK, as long as they include a contrived set-up (such as retyping your entire to-do list). Applications with built-in reminder and/or deadline functions are acceptable as long as the targets you set yourself are optimistic to the point of being unachievable; allowing them to be safely ignored.

 

Subscribe to a productivity blog

If your new productivity method isn’t working out (or you haven’t got round to trying one), try subscribing to a productivity blog. The endless torrent of advice and reviews will keep you productively idle for many hours every week.

These blogs provide great material for filling your bookmark folders with articles for later review. You can even swamp your to-do list with droves of “must try out this new prod app…” and similar unwork tasks to provide decoys in case you later find yourself accidentally attempting to actually do any work from your to-do list.

 

Still looking for unwork?

Leave me a comment telling me about your best unwork tasks.

Feb 252012
 

This is a classic SharePoint stumble: You want to delete a site (SPWeb), so you think “I’ll just use the Delete method. Obviously!” as anyone would. A few moments later and you’re staring at this obstinate and unshiftable error message:

Microsoft.SharePoint.SPException : Error deleting Web site “/web”. You can’t delete a site that has subsites.

Eventually you resign yourself to having to write some form of recursive function to delete every subsite’s subsite’s subsites one by one.

*sigh*

So let me make your life a little easier. Stick this static class in your reusable library of helpful classes (everyone’s got one), and forget about the problem forever:

public static class SPWebFix
{
    /// <summary>
    /// Deletes the Web site, optionally forcing the deletion of subsites
    /// </summary>
    /// <param name="web">The site to delete</param>
    /// <param name="force">Forcing deletion causes the site to be deleted even if it has subsites</param>
    /// <returns>The total number of sites deleted</returns>
    public static int Delete(this SPWeb web, bool force)
    {
        if (force || web.Webs.Count == 0)
        {
            // Call the recursive function
            return deleteWeb(web);
        }
        else
        {
            // Return 0 to indicate that this site was not deleted.
            return 0;
        }
    }

    private static int deleteWeb(SPWeb web)
    {
        int sitesDeleted = 1;

        foreach (SPWeb subWeb in web.Webs)
        {
            sitesDeleted += deleteWeb(subWeb);
        }

        web.Delete();
        web.Dispose();

        return sitesDeleted;
    }
}

Now whenever you want to recklessly delete a site and all its subsites, simply call the extension method version with the ‘force’ flag set to true:

deleteThisWeb.Delete(true);

That’s one tiny problem fixed.Smile

Jan 152012
 

Tomorrow I’m taking a couple of exams for work (for you SharePointers: 70-573 and 70-576). I have to go all the way to Bristol, so I’ve booked a train ticket and I’m planning to cycle the 4 miles to the station.

I’ve booked my first exam pretty early, to fit them both in the same day (3 hours each!). This means I’m taking the first train of the day; which leaves about the same time as the first bus of the day (hence the cycling).

The Problem

All’s well and good until I skim through the exam centre notes, and see this grimace-causing little paragraph:

Do not bring notes, pens, pencils, paper, large purses, or backpacks to the test center. … There is no secure storage available for large books, bags, or large coats.

Oh good. I was just thinking how my magical powers of backpack-disappearing were underused. But I’ve got nowhere to put my mystical box, magic wand, and assistant while I’m in the exam. Damn.

So what to do with my backpack? There’s no lockers available at most stations anymore (goshdarn Irish terrorists). It’s also unlikely I’ll be able to leave my bag anywhere else (goshdarn extremist terrorists). The answer is clear: Don’t take a backpack.

The Solution

Time to leave my hoarding tendencies behind, and take only the bare essentials:

P1020803

From the top left:

  • Long sleeve t-shirt: Roll up sleeves while cycling, warmer when walking.
  • Fleece jumper: Amazing light and warm (it’ll be 4C), and can be tied around waist while on bike (or shoulders for preppy-fashion).
  • Hat: On head for warmth, or in pocket wrapping electronics to absorb cycle-sweat.
  • Keys: House, bike, bike’s shed. Just small enough to fit in that tiny pocket-in-a-pocket. I’m leaving my beloved bottle-opener behind. Sad smile
  • Cash: “Ooooh look Moriarty: Money”.
  • Kindle: Containing revision notes for the train journey.
  • Convertible trousers: Shorts for cycling, trousers for not.
  • Wallet: Made from duct-tape one boring November evening. Contains essential ID for exam admittance, and train tickets.
  • Phone: All the kids have them… and old people… and some gas meters, apparently. This has my exam confirmation e-mails pre-downloaded, just in case.

Obviously missing from this photo is my helmet; which should most definitely be going with me.

Perhaps this’ll be useful to fellow cyclists with similar luggage bottle-necks… Or perhaps I just like to show off my cool things. Smile

Oct 252011
 

I’ve written an article I’m particularly pleased with on my work blog:

SharePoint Questions: MSDN versus Stack Exchange

Graphs, statistics, comparison tables, and more! Here’s the intro:

SharePoint is an enormous heaving behemoth of machinery; full of spinning cogs, churning engines, and peculiar dials. We’ve all worked with parts of it, but not even those that created it understand all of its inner workings.

So where do we go when the wheel that goes ‘whir’ is going ‘squeakity’? Or when we’re having trouble bolting on some shiny new levers? What we need is an expert in that area.

Aug 162011
 

Writing code to get or set data in a lookup field (SPFieldLookup) or its descendant the User field (SPFieldUser) can be a real pain in the eyes. Thankfully there’s a handy couple of classes that can make life easier.

If you’ve ever frowned at “;#” delimiters, and begrudgingly twisted a for clause to check every other line, then you should most definitely read on.

A bit of background

Most complex field types have a Value class; a class that handles serialising and deserialising an item’s data for that field. If the field can have multiple values then there is often also a Collection class (a generic collection in the form List<Value>).

For lookups these classes are called SPFieldLookupValue and SPFieldLookupValueCollection. For User selections these are SPFieldUserValue and SPFieldUserValueCollection.

Getting single items

If you only have one value in a lookup, then this can be accessed using the following:

SPListItem item = SPContext.Current.List.GetItemById(1);
 
if (item["LookupField"] != null)
{
     string fieldValue = item["LookupField"].ToString();
     SPFieldLookupValue value = new SPFieldLookupValue(fieldValue);
     int lookupListItemID = value.LookupId;
     string lookupListValue = value.LookupValue;
}

Not a single split string in sight. To do the same for a single user field, you do the following:

SPListItem item = SPContext.Current.List.GetItemById(1);
 
if (item["UserField"] != null)
{
     string fieldValue = item["UserField"].ToString();
     SPFieldUserValue value = new SPFieldUserValue(SPContext.Current.Web, fieldValue);
     SPUser user = value.User;
}

The SPWeb passed into the constructor above is used to resolve the User; if you’re writing cross-site code make sure you pass a Web that recognises the User.

Setting single items

Setting lookups is quite straight forward:

SPListItem item = SPContext.Current.List.GetItemById(1);
int id = 1;
item["LookupField"] = new SPFieldLookupValue(id, string.Empty);
item.Update();

id is the item ID in the lookup list, and the string.Empty is the optional (as far as I can tell) display value. The display value is populated using the ID once the item is updated, so we needn’t bother getting it ourselves.

Setting a single user field couldn’t be easier, and requires no special tools, classes, or qualifications:

item["UserField"] = SPContext.Current.Web.CurrentUser;

Multiple items

Now we’re getting into more interesting territory. Multiple choice Lookups can be accessed using the previously-mentioned SPFieldLookupValueCollection. This is a collection of SPFieldLookupValue objects that each represent one of the values.

The collection can be used to get information like this:

SPListItem item = SPContext.Current.List.GetItemById(1);
if (item["LookupField"] != null)
{
     string fieldValue = item["LookupField"].ToString();
     SPFieldLookupValueCollection values = new SPFieldLookupValueCollection(fieldValue);
     foreach (SPFieldLookupValue value in values)
     {
         int lookupListItemID = value.LookupId;
         string lookupListValue = value.LookupValue;
     }

}

And to set the item data like this:

SPListItem item = SPContext.Current.List.GetItemById(1);
SPFieldLookupValueCollection values = new SPFieldLookupValueCollection();
values.Add(new SPFieldLookupValue(1,string.Empty));
values.Add(new SPFieldLookupValue(3,string.Empty));
item["LookupField"] = values;
item.Update();

The SPFieldUserValueCollection is used in almost exactly the same way. The only differences are that the constructors require an SPWeb, and SPUser.ID is used for the LookupID.

Pretty neat

Well, I thought so.

All this was probably old news to some, but it was a Christmas stocking of happy surprises for me when I found it. :)

Jun 292011
 

Code loves MusicJust the other day I was bludgeoning my way through some code and someone walked up to me and said: “Gosh Stu, you always look so focused when you’re working with your music on. What do you listen to when you’re zoned-in like that?”

To which I distractedly replied “Well Dave, imaginary friend of mine, when I’m zoned-in (like I was just now) I listen to all sorts of things. Have-a-nice-day-now-thanks-bye.” Which in retrospect was needlessly abrupt and dismissive of Imaginary Dave, so let me atone my rudeness by expanding on my answer.

All Sorts of Things

This is a lie. What I actually meant was “Things That Fall Into Certain Specific Categories.” (well, actually I meant “Bugger off Dave“). If you’re trying to concentrate the last thing you need is a distraction, and this holds true for the music you’re listening to. Here’s a list of things I look for when choosing music to code by:

Unobtrusive Lyrics

Whether it’s an amusing turn of phrase* or an endlessly looped sample**, if you’re thinking about the lyrics then you’re not on the right track, so to speak. There is a surprisingly huge selection of music that contains no lyrics at all (not just elevator music) but I’ll go into that later.

Consistency

Harsh or frequent track changes can draw your attention. Albums with long tracks will help alleviate this, but sometimes it’s good to find one with a consistent theme instead. Nothing’s worse than having an introspective
progressive metal epic gatecrashed by passing gypsies… or it could just be me.

Uplifting Theme

Even if it fulfils the previous requirements, if it’s going to sap your will to live it’ll damage your motivation to code on the way. With slightly droney vocals and consistent theme The Gathering is a great example of this; yes, in the video she’s both strangely enticing and smiling at you, but she also happens to be soul-suckingly depressing to listen to for any length of time. Which is a boon if you’re into that kind of thing, I suppose, but not useful to us in this context.

Perhaps I Should Actually Recommend Some Music

Post-rock (‘post’ as in ‘after’ rather than lampposts) is a wildly varying but often intriguing genre that generally decided that there was much more to music than shouting your opinions at people… did I mention Punk is a bad choice? Anyway, if you’re looking for some good starting points, I’d recommend Explosions In The Sky and Yndi Halda.

Another area of music that by its nature often avoids needlessly grabbing your attention are albums specifically composed as soundtracks. Of course this is broad area, so you’ll have to choose carefully (beware The Labyrinth). Music from games you’ve played and enjoyed are always a great choice, as you’ve already trained yourself to ignore it and as a bonus have associated it with enjoyment. My most ignored list includes The Longest Journey and World of Goo.

Of course I can only vouch that the above work for me, and may be annoying to the Enya-th degree for many others.

* I can’t listen to ‘Books from Boxes‘ without smirking at the artfully shoehorned “I find the weight upon your kiss ambiguous”.
** I’m looking at you Daft Punk. You and your goshdarn ‘Steam Machine‘.