Website Bandwidth Usage

Off topic a little for SharePoint, but we all know the value of a Content Delivery Network (CDN), right? In particular, using services that host commonly used files, like jQuery.js, etc.? This has the advantage that other sites that use that CDN may have already cached that file in your visitor’s browser, but it also reduces the bandwidth used by your site.

Well, I found that my site was spending a lot of bandwidth serving jQuery.

Capture

Yup, 10% of my site’s bandwidth was being spent on… serving jQuery. That’s not efficient, so I found this post, which describes how to make the site use a CDN instead. Note that the functions.php file it mentions is the one in your theme.

Hopefully, that’ll reduce the bandwidth used. I also changed the css files for the theme, by minimising them; that should save another 200Mb per month. In total, that should be about a 12% saving on bandwidth.

It’s funny how this all mounts up!

Advertisement
Website Bandwidth Usage

MSI Setup projects in Visual Studio : 2005 != 2008

I’ve been working on a project that is a shared plugin to Office 2003. I was writing this in Visual Studio 2005, but for a variety of reasons (not least of which was having a tidier dev environment), I decided to move this onto a convenient VM which happened to have a lot of the things I needed (MOSS, a domain controller, AD, exchange).

Unfortunately, it also had Visual Studio 2008 too. I didn’t think this would be a problem, though, and so I when I opened the project on it for the first time and it asked me to upgrade the project to 2008, I was happy do. I didn’t think there’d be a problem.

Well, during development, there wasn’t. Whenever I went to test my MSI installer, though, I started to have problems. Installation kept failing and I kept getting the error:

Error 1937. An error occurred during the installation of assembly ‘Extensibility,Version=”7.0.3300.0″,Culture=”neutral”,PublicKeyToken=”B03F5F7F11D50A3A”,ProcessorArchitecture=”MSIL”‘. The signature or catalog could not be verified or is not valid. HRESULT: 0x80131045. assembly interface: IAssemblyCacheItem, function: Commit, component: {8C306A7E-AE8E-14F0-4168-C43060985CF4}

This was surprising. Extensibility.dll isn’t one of mine – it’s a Microsoft one that should’ve been in the Primary Interop Assemblies for Office. Anyway, it’s not one of mine, it hadn’t changed, and it was signed correctly. So what gives? Continue reading “MSI Setup projects in Visual Studio : 2005 != 2008”

MSI Setup projects in Visual Studio : 2005 != 2008

The circular logic of the WSS Lists Webservice GetListContentTypes call

So, I need to get a list of the content types applied to a library. The Lists webservice has a call for this:

<getlistcontenttypes xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listname>string</listname>
<contenttypeid>string</contenttypeid>
</getlistcontenttypes>

So, I’m connected to a site, I supply a list name to identify the list… …but what do I give as a contentTypeId? I don’t have a f$%king clue – I was calling this function to try to find out what content types were valid!

Well, good news. It doesn’t seem to matter what you put in, you always get a list of all the content types on the list. I used the following code…

WS_Lists.Lists lsts = new WS_TestApp.WS_Lists.Lists();
lsts.Credentials = System.Net.CredentialCache.DefaultCredentials;
XmlNode node = lsts.GetListContentTypes(libraryName, contentTypeID);

I figured that maybe they wanted the base content type for what I wanted back, so I tried setting contentTypeID to documents (0x0101) and got back a list of all the content types. I then set contentTypeID to “fish”, and still got back a list of all the content types. As far as I can tell, the second parameter doesn’t do anything.

Side note: The first content type returned is your default content type.

Side note 2: There doesn’t seem to be an easy way of identifying non-visible content types…

The circular logic of the WSS Lists Webservice GetListContentTypes call

Are web services really that great?

So I’ve been working for the last few days using SharePoint’s web services extensively. They are pretty neat insofar as they offer a very public set of interfaces – the communication is pretty much human readable (for a given geekiness of human).

However, a couple of things have struck me. First was the bandwidth needed. Some of the calls I’m making were getting back 50k responses – and for a simple action in the app I’m working on, I could have to make lots of those just to display a form to a user. 1Mb downloads to show this form were likely – so this isn’t great. Presumably, enabling compression on the web server should reduce this considerably (looking at the XML in the file, it seems to have a high redundancy), but only at the cost of extra processing. Still, I can live with that.

The second, and in some ways more fundamental point, is that I find myself having to write wrappers for the various web services. I know, calling a web service in C# is dead easy, and that’s great, but the response -yuck! Everything seems to come back as lots of XML. And I do mean lots. I don’t actually want to deal with reams and reams of XML. Object oriented programming sort of implies that I should be trying to deal with objects. After all, that seems to be what much of ADO.NET is about – presenting data as objects.

So, for comparitively well known web services, can’t we have a pre-built wrapper so that I’m just dealing with objects? Both in and out. That way, well, if I want to talk to the web service via XML, directly, well, I can. If I’d sooner work with objects, then I could do that also. Just at the moment, there seems to be an asymmetry – I supply an function with parameters and it produces the request in XML. Then when I get the response, well, it’s just XML.

Hell, isn’t that what SOAP is all about? A common communication layer between remote objects?

In fact, thinking about it, some of the web service requests need XML put into them too – but that’s CAML, and another gripe entirely.

Are web services really that great?

Abject Failure and Complexity

I’ve been meaning to post this for ages – Marus Ranum on why information security is an abject failure. And he’s right – the problem is the complexity of todays interactions, both at a protocol and language level.

To me, the problem is one of failure of KISS (Keep It Simple, Stupid). Applications and protocols haven’t been, and we’ve had more tacking together of technologies, and expansion of complexity of everything.

I mean, consider what languages you needed to know 10 years ago, and now:

Then:

HTML 3.2, JavaScript maybe, Perl if you’re brave, SQL if you’re a hero.

Now (Microsoft Stack only):

HTML 3.4, 4 (various favours), XHTML, XML, XSL, XPATH, JavaScript (much more complex), ASP.NET 2.0, C# or VB, .NET frameworks 1.1, 2, 3 and 3.5 (soon), ADO, SQL, CSS, ‘AJAX’

That’s just the languages and base technologies – never mind getting into a higher level of software (e.g. SharePoint). Or non-MS technologies – Ruby, Rails, Python, Java in various forms…

It’s similar in protocols…

Then:

HTTP, HTTPS, FTP, SMTP / POP

Now:

HTTP, HTTPS, FTP, SMTP / POP, SOAP, Web Services (plus various extensions), IMAP, Various Peer-To-Peer protocols, Various Instant Messaging protocols

(Yes, those are fairly high level, and from different levels of the stack – but still, you’re expected to know about them.) (And yes, I suppose you’d need to know a bit about TCP/IP and IPSEC)

Does that sound simple? Does my granny skateboard?

(Well, no, but that would be so cool).

Security will be impossible with such a complex, varied stack of technologies, and developers simply won’t be able to specialise enough to know how to make secure enough applications. It alarms me how wrong people are getting password storage alone – I mean, this stuff has been known since the 70’s. If they can’t get that right, how will they manage with a such a deep and varied set of tools?

Abject Failure and Complexity

Excelllent – A CAML query generating library

To those of you who’ve never written a CAML query, this won’t seem exciting. For those of you have have spent hours digging through reams of XML searching for a fault in your query, this will be heaven sent:

CAML.NET assembly – write your queries in C# – and you can find it on Codeplex.

Queries are now as simple as:
string s = CAML.Query(
CAML.Where(
CAML.Eg(
CAML.FieldRef("SomeField"),
CAML.Value(someValue)
)
)
)

This is such a blatantly good idea that I’m giving it a

Comments from my old blog:

 

Now that *is* a good idea…

By Jonathan at 17:11:14 Sunday 13th May 2007

Excelllent – A CAML query generating library

Getting the Public Key Token without copying things into the GAC

1) Create your Key pair, as per normal. Typically, this can be done as:
Sn.exe -k PublicPrivateKeyPair.snk
This will create a file containing both keys.

2) Extract the public key:
Sn.exe -p PublicPrivateKeyPair.snk PublicOnly.snk

3) Calculate the token. Note that the ‘-t’ parameter MUST be lower case (‘-T’ does something different)
Sn.exe -t 'PublicOnly.snk'
And there you have the public key token

Getting the Public Key Token without copying things into the GAC