Just got this whilst trying to play an iTunes rental – 5103:
This was the solution:
http://support.apple.com/kb/TS1389
Just got this whilst trying to play an iTunes rental – 5103:
This was the solution:
http://support.apple.com/kb/TS1389
Posted by lbarclay on January 28, 2012
http://lbarclay.wordpress.com/2012/01/28/itunes-5103-delete-your-sc-info-folder/
A developer friend of mine emailed me with a question about Classes in Javascript:
Don’t suppose you have any literature or anything I can look at in regards to the correct structure for a javascript class (in node.js)?
I have looked all over the shop and found various different ways of doing it but am having problems.
Classes don’t exist in Javascript (yet), at least not natively. There is some work on EcmaScript / JavaScript.next that suggests they might but, in short:
Javascript is lexically scoped and functions are ’1st class objects’.
You can declare and instantiate objects in many ways but the most familiar might be like this:
function foo(bar){
this.bar = bar;
}
var myFoo = new foo('oh hi there');
alert(myFoo.bar);
Where you’d normally use the term ‘class’, it’s implied in Javascript, as above for example, but not explicit. There are also many different ways to approach this. Javascript does not support access levels (private, public, protected etc) natively, so you have to follow a coding style that will have the same effect.
There many different patterns you can use, but different patterns work well for different problems and you don’t always want to use the classical (class based) style, you can do things differently in Javascript and utilise the flexibility of the language to your advantage.
Read mostly everything Douglas Crockford writes: (and get his book on Javascript – The good parts). Although I disagree with some things he says about coding style, it’s all relevant even though it was written a while ago.
http://javascript.crockford.com/prototypal.html
http://coding.smashingmagazine.com/2009/08/01/what-you-need-to-know-about-javascript-scope/
http://blog.morrisjohns.com/javascript_closures_for_dummies
http://www.dyn-web.com/tutorials/obj_lit.php
http://www.dustindiaz.com/javascript-curry/
http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
That should be enough to get you started!
Posted by lbarclay on January 26, 2012
http://lbarclay.wordpress.com/2012/01/26/class-and-object-definitions-in-javascript/
I created linkify after using the @anywhere Twitter library and found that it didn’t automatically link urls in tweets or hash tags.
$([selector]).linkify(); / $([selector]).hashify();
$(‘p’).linkify(); – convert all recognised urls in all matched paragraph elements to hyperlinks.
$(‘p’).hashify(); – convert all recognised hashtags in all matched paragraph elements to links to hash tags on Twitter.
$(‘.toLink’).linkify(); convert all recognised urls in all matched elements with the class .toLink to hyperlinks.
$(‘.toLink’).hashify(); convert all recognised hashtags in all matched all matched elements with the class .toLink tags to links to hash tags on Twitter.
Simple not much to it.
Posted by lbarclay on January 21, 2012
http://lbarclay.wordpress.com/2012/01/21/a-simple-jquery-plugin-to-automagically-create-anchors-from-recognised-http-links-and-convert-hash-tags-into-links-on-twitter/
I just finished working on the first release of this website (above) for Peter Grundy, with Further Creative http://www.furthercreative.co.uk.
After discussing with the user experience expert and designer, I faced the usual development decisions. I chose some solutions which use technology that I’d not employed in anger on many projects before. With Peter’s content being heavy on the visual side, delivered via Flickr, my decisions were largely driven by how well we could present his work, over any potential SEO ranking.
I don’t remember enjoying working on content that was as stimulating and interesting as the work that Peter creates. Luckily Further allowed the user experience expert, designer and myself enough time to try and achieve what we set out to do and I think this first release is very close to getting there.
Working in a good team always makes work more enjoyable, and the client is always part of a wider development team. In this case the team was great and the content we were working on was inspiring.
I hope it’s not too long before I get to work on the same kind of project again!
Posted by lbarclay on January 21, 2012
http://lbarclay.wordpress.com/2012/01/21/interesting-content-it-makes-work-less-work-like/
I wanted to add some ShareThis buttons on a page in an single page web application and update the link to be shared every time the hash was changed.
The shareThis functionality didn’t really allow this ‘out of the box’ and it took me a while to work out the best way to do it using Google and their API documentation.
Share an AJAX friendly / hashed url that updates along with the hash, using ShareThis and some custom button images
I wrote a small Javascript function to do it (it’s not pure JS as I was using jQuery anyway.
IMHO the solution isn’t ideal as I don’t really like having to recreate te buttons every time, but it seems like the only way to make it work.
You can find the code on github here.
//---->BEGIN
function updateShareButtons(location, title, imgsrc) {
$('.share').hide();
$('.sharethis').html('');
var services = [
{type : 'facebook',
image : './css/img/social-facebook.png'},
{type : 'twitter',
image : './css/img/social-twitter.png'},
{type : 'email',
image : './css/img/social-email.png'},
{type : 'sharethis',
image : './css/img/social-more.png'}
];
var svc, elm;
for (var i = 0; i < services.length; i++) {
svc = services[i];
elm = $(['
'].join(''));
$('.sharethis').append(elm);
}
stButtons.locateElements();
$('.share').show();
}
//----<END
Posted by lbarclay on December 5, 2011
http://lbarclay.wordpress.com/2011/12/05/creating-sharethis-buttons-with-custom-images-in-javascript/
I attended full frontal last week, which was excellent. It gave me inspiration to experiment a bit with some JavaScript.
I went about setting myself a very loose brief; Completely written in JS, I wanted to do something quick, in no more than seven hours, I didn’t want to have to write any server-side code and wanted the code to reside on a single page.
I went about looking into the Twitter and Flickr APIs and decided to combine them by doing a photo search on Flickr using tweets from the Twitter public timeline every 60 seconds.
What I came up with ended up as a kind of visual social commentary using Twitter and Flickr.
I can’t claim any credit for any of the content and I doubt that the idea is unique or original but I did set out some rules for getting the content : search terms had to exceed two words and I attempted to recognise proper nouns and only use them. The content updated every minute. The tweets must not be recognised replies.
The result gave some interesting effects on me as a viewer. The search result images weren’t always obvious results from the tweets, hey – people tag their photos with strange tags. So knowing that I only had 60 seconds to look through the tweets (not always in English) it made trying to figure out the relationship of the narrative with the corresponding photos more important, somehow and it became more important to look at the photos and see where the connections came from when I got frustrated.
I also liked the fact that very few users would see the same page with the same tweets and images. This makes me want to expand on the idea and add the option to ‘save your favourite fleet’ (a fleet is what I called the combination of tweet a Flickr images, brilliant hey!)
I thought about adding the option to enter a twitter screen name and allow that to work in the same way on a specific timeline.
Posted by lbarclay on November 26, 2009
http://lbarclay.wordpress.com/2009/11/26/my-twitter-flickr-mashup/
Having seen a lot of league tables on various websites I was suprised to not see the implementations use the UI more effectively. Most of the implementations required the user to click on seperate links to view the current table, results or fixtures.
I was interested to see if I could provide an easier way of navigating between these sets of information, whilst providing a generic API to support different sports, using Javascript only, fed by JSON serialised data.
I naturally chose soccer (football!) as the base of my test data and used the current English Premier League teams to build a demonstration table.
This is what I’ve come up with so far: Javascript League Table and Fixtures
What I’ve done so far is delieverd completely in Javascript and is a bit verbose! If anyone is interested in getting me to develop it further for their website then let me know!
Posted by lbarclay on August 15, 2009
http://lbarclay.wordpress.com/2009/08/15/javascript-league-tables/
I have found myself using ExtJS on both of the last two contracts I have worked on.
I have found that the API documentation, however well organised, doesn’t suit me.
Finding examples that are specifically what you need can be a difficult task as they tend not to exist in the documentation itself but are more often than not found fragmented in the forums, across several posts, or in the example pages within the ExtJS site.
I’m not sure if this is intentional and meant as a way of pushing the user to buy a support contract but it can be frustrating. As well as this the extensiveness of the ExtJS library causes me to sometimes forget some of the more straightforward principles in Javascript and become more lazy, expecting things to ‘just work out of the box’.
An example of this occurred this afternoon…
Posted by lbarclay on March 19, 2009
http://lbarclay.wordpress.com/2009/03/19/extjs-stores-and-baseparams/
I was sat at the airport the other week with very little to do.
I turned on my 13 and a half month old (that’s one and half months out of warranty I believe, around 45 days) MacBook Pro , that I love and has been working perfectly since I purchased it and I couldn’t type in my password when it came to logging in to OSX.
‘No problem’ I thought, ‘a simple reastart should fix this’.
Hmm. Not so. On restart this time, I realised that th Trackpad wasn’t working also.
‘One last try, booting into Windows instead’ was my next thought. Only, holding down the Alt key wasn’t bringing up the boot loader menu!
Blimey, I was busy.
After a flight home fraught with concern, a few minutes ignoring my girlfriend when I arrived home and the meal she cooked ‘because my laptop is broken’ I calmed down and took out the battery.
Anyway, what I found was that there are two small ribbon cables just under the battery in my MacBook Pro (Revision :3,1). The darker orange / brown cable was the one causing trouble.
To discover this I:
Although there was no visual signs of a problem, it seemed as though the ribbon cable had heated up too much and become warped. When pressed down the keyboard functioned perfectly.
So, I started looking for a company to repair my Macbook and, I found a local Apple repair center who, after hassling them without any response on a Saturday, fair enough on the weekend I guess, responded at 9.15 on Monday morning, with a price.
I’ll be honest, I wasn’t happy about the £250 price tag, ‘because the whole keyboard housing was going to have to be replaced’, which I suspect was Apple, not Amsys’ reasoning, but the response time was the best I could have expected. Well done Amsys.
Not getting a response until I was back in another country on Monday morning did however leave me with a weekend to work out my own fix.
Before you try this, it is temporary and I’d like my MacBook Pro to be fully functional without the use of Sellotape (Scotch tape, whatever) at some point, as I’m sure you would. I take no responsibility for burnt laps, smoking MacBooks or the smell of burning glue or any other associated issues the fix might cause.
This worked for me, but did take a few attempts, and it is still working after three weeks!
Let me know if you’ve had the same issue please, or if you know of an alternative fix or repair centre!
Posted by lbarclay on January 29, 2009
http://lbarclay.wordpress.com/2009/01/29/macbook-pro-trakpad-and-keyboard-not-working/
In this Post:
I’ve just started using the xUnit framework, and inherently the xUnit approach as a unit testing framework within .Net. For the purpose of this post and to avoid confusion when I say xUnit, I’m talking specifically about the framework!
I’m using ReSharper and the integration is really useful. I have a VS2008 standard edition license and it adds the UI point and click testing environment I lack, not having the heavier weight VS editions.
I’m currently building an MVC application and have abstracted out the model into seperate project(s).
This leaves me with the following projects as part of my solution:
Add a reference to xunit.dll so that you can write unit tests using xUnit , as well as referencing any of the projects that you are going to write unit tests for, in my case both the Model and Web Projects.
I structured my unit test project into the followiung folders:
I collate my tests into logical collections. So unit tests for a Foobar class, in my model layer, would be created in a class in the /ModelTests folder:
Using the Foobar class as an example:
namespace SolutionName.Model
{
public class Foo
{
public int MyValue { get; set;}
public Foo(int initVal)
{
MyValue = initVal;
}
public int Bar(int toAdd)
{
if (toAdd < 10)
MyValue += toAdd ;
return toAdd;
}
}
}
I wrote the following (far from exhausitve) example test:
namespace SolutionName.Tests.xUnit.ModelTests
{
public class FooTests
{
private Foo thisFoo;
public FooTests()
{
//SETUP[ARRANGE]
thisFoo = new Foo(5);
}
~FooTests()
{
//TEARDOWN
thisFoo = null;
}
[Fact]
public void TestFoo_MyValueHasExpectedValue_AfterInstanciation()
{
Assert.Equal(5, thisFoo.MyValue);
}
[Fact]
public void TestFooBar_MyValueIsSame_AfterBarMethodPassingValueGreaterThanTen()
{
int expectedValue = thisFoo.MyValue;//[ARRANGE]
thisFoo.Bar(100);//[ACT]
Assert.Equal(expectedValue, thisFoo.MyValue);//[ASSERT]
}
[Fact]
public void TestFooBar_MyValueExpectedValue_AfterBarMethodPassingValueLessThanTen()
{
Assert.Equal(5, thisFoo.MyValue);
int newValue = 9;
int expectedValue = thisFoo.MyValue + newValue;
thisFoo.Bar(newValue);
Assert.Equal(expectedValue, thisFoo.MyValue);
}
}
}
Developing units with xUnit sits more naturally than other frameworks I’ve used. I try to think of the test itself as a self contained object that has a constructor for setup and destructor for tear down (as well as helper methods where necessary) and then each method should contain the following:
The test we’re interested above is:
TestFooBar_MyValueIsSame_AfterBarMethodPassingValueGreaterThanTen
Where I marked the AAA code!
The first thing to do is to check that the xUnit Test Runner plugin is installed and recognised by ReSharper:
If so you should see green and yellow ‘test icons’ on the left hand side of your code, one for your test class (to run all tests) and then one for each individual test.

Running unit tests in ReSharper
To run your tests simply click the icon for your test class and choose Run or Debug to debug your code.
Lewis Barclay
Web Development and Web Consultancy
Posted by lbarclay on January 22, 2009
http://lbarclay.wordpress.com/2009/01/22/setting-up-unit-tests-with-resharper-and-xunit-in-c/