Category Archives: Techniques

Embedding Video in Sharepoint 2007

If you want to embed video in Sharepoint 2007 you have two options:

  • upload to a 3rd party video service (Youtube, DailyMotion, etc) and then use their embed code, or
  • upload to Sharepoint itself and roll your own code.

Either way you’ll add that code to your page using a Content Editor webpart.

Which to choose?

A 3rd party service has the advantages that it handles all the storage, conversion to suitable formats, streaming, etc.  It also, often, allows you to upload files much larger than corporate intranets allow.  However it is less secure, and most IT departments baulk at sharing corporate files externally.  That’s if you bother to tell them.  You’ve also the issue that if your internal audience does not have internet access then your video will not play.

Rolling your own internally is a lot less risky from availability and security perspectives.  But you do need the tools/support to ensure the video can be delivered in a size (file and resolution) and format that will work for you.

Code to use – 3rd party site

To use Youtube, or similar, simply upload your video to their site and then copy the code they provide for you to embed that video on your site.  You’ll find it somewhere under “share” or similar headings.  For Youtube (this week’s interface design) it appears below the video under Share > Embed:

embedYoutube

Code to use – DIY

If uploading the video to your own site, copy the following code to add to your sharepoint page.


<object classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" 
width="640" height="360" id="mediaplayer1" title="Win Media Player">

<param name="FileName" value="/path/to/video.wmv">
<param name="AutoStart" value="False">
<param name="ShowControls" value="True">
<param name="ShowStatusBar" value="False">
<param name="ShowDisplay" value="False">
<param name="AutoRewind" value="True">
<param name="DisplayBackColor" value="True" />
<param name="BufferingTime" value="6">

<embed src="/path/to/video.wmv" width="640" height="360" 
 autostart="True" type="application/x-mplayer2"
 pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
 filename="/path/to/video.wmv" showcontrols="True" 
 showstatusbar="False" showdisplay="False" autorewind="True" 
 displaybackcolor="True" bufferingtime="6">
</embed>

</object>

Notice you have to enter your video filename (and path) in three separate locations. And you have to enter the width and height twice.

There are a heap of options listed in the above code. Feel free to tweak. The above set is my default set.

Adding to your page

To add the code, either set, to your page, add a Content Editor Webpart.  Click the Source Editor button.  Then paste in the appropriate code.  Save, sit back, and revel in your awesomeness.

Then for bonus points see if you can find a way to show something other than a blank, black screen when the video first appears on the page. Short of some JQuery smarts where you show a screenshot image that when clicked is replaced by the video with Autostart, not sure what can be done?

Fixing Tiny Comments in MS Word 2003

I just got to experience the miniiature comment feature of MS Word. Essentially after passing a document around with tracked changes, when it came back to me all the comments are much too small to read.

Google to the rescue, where all the conversations say you just need to change the settings for the Balloon Text style. Apparently this unilaterally decides 1pt is perfectly acceptable.

The problem is you cannot find Balloon Text in the default list of styles, even when you choose “All Styles”. The resolution was in this article: How the Styles and Formatting pane works in Microsoft Word 2002 and 2003 by Shauna Kelly.

Essentially the “All Styles” dropdown option under Styles&Formatting does not show all styles in Word 2003. Instead you need to choose Custom, and from there click a different “All Styles” button. Then you get Balloon Text in the list and are free to reset that stupid font size.

Almost annoying enough to warrant upgrading to that new Word with the ribbon thing. Almost.

Working with Sharepoint Surveys (ie getting them to work properly in Sharepoint 2007)

Been including a few surveys in recent Sharepoint solutions. And there are a few simple tricks necessary to have them function in a “standard” manner.

(1) how to link to the survey form itself, not to the survey
(2) how to allow your visitors to actually complete the thing
(3) how to send your users somewhere useful after completing the survey

Note: These lessons learnt come from working with Sharepoint 2007. Your mileage may vary with other versions.

(1) how to link to the survey form itself, not to the survey

An easy one. By default if you link to a survey Sharepoint points you to overview.aspx. Which is painful since this is the survey summary page, which then forces your user to click again on a hard-to-find “Respond to this Survey” button to actually complete the thing:

Oftentimes you just want to have a link that when the user clicks it, the survey opens immediately.

To link directly to the survey, use NewForm.aspx, instead of overview.aspx. Eg:

If your survey appears as:

http://server.com.au/blah/survey/overview.aspx

then create your link to:


http://server.com.au/blah/survey/NewForm.aspx

.

This will then present the actual survey form, ready to complete.

(2) how to allow your visitors to actually complete the thing

Surveys are added to your site as just another list. This means the standard permissions (visitor, member, owner) applied to the site automatically apply to the survey itself. And if most of your visitors only have read access, then they won’t be able to complete the survey.

The simplest solution in this case is just to edit the permissions for the survey directly, and bump up the existing Visitors group to have contribute access. To do so:

  1. From the survey overview.aspx page, choose Settings > Survey Settings
  2. Under Permissions and Management, click on Permissions for this survey
  3. Under Actions choose Edit User Permissions. This will break the default inheritance of permissions from the site.
  4. Now edit the permissions to “bump” your visitors up to contribute access.

While you’re in the survey settings, click on Title, description and navigation under General Settings. This includes some important extra configuration items you might want to change:

(1) whether survey results show user names (default = Yes)
(2) whether users can complete a survey more than once (again, default = Yes)

These are two settings I regularly have to change for each survey.

(3) how to send your users somewhere useful after completing the survey

By default when a user completes (or cancels) a survey they are returned to the survey overview page. Which to my mind is an ugly “backend” page best kept away from.

To improve the navigation, edit the survey link (..blah../NewForm.aspx) and add “?Source=” plus the URL of where you want the users to go to. This can direct them back to the calling page or (my favourite) a thank you page with related links for next steps.

For example, linking to a special thank-you page:

<a href="http://server.com.au/blah/survey/NewForm.aspx">
   Fill in the survey</a>

becomes

<a href="http://server.com.au/blah/survey/NewForm.aspx?Source=
   http://server.com.au/blah/Pages/Thanks.aspx">
   Fill in the survey</a>

Note users are directed to your page whether they submit the survey or Cancel out of it. As a result be careful about your wording; you cannot assume they’ve reached your page after successfully submitting the survey.

Conclusion

Sharepoint surveys are actually pretty powerful tools for eliciting and managing user feedback. And with some simple tweaks they can be made to integrate well with your site.

For more survey goodness, check out Mike Smith’s blog post on the beasts. He describes the Source? hack, as well as some other more advanced options around dialog boxes and default messages.

Who can rid me of this troublesome UPK error?

Every now and then UPK seems to forget I closed it down. And when I relaunch it I get this delightfully useful message:

Nothing in tools menu actually helps. Only way I’ve discovered to be able to relaunch UPK is to physically reboot my PC. And since I’m in corporate-land (and Windows is a joy) that’s 20mins of my day gone.

Anyone know how to get past this “feature”?

Using Javascript with Sharepoint 2007

It’s relatively simple to include Javascript in your Sharepoint pages. With some judicious editing you can add your code inline or via separate code files.

Embedding Javascript

To include Javascript in your page:

  1. use a Content Editor Webpart (CEWP)
  2. edit via the Source Editor button (not Rich Text Editor), and
  3. add your code within standard <script></script> tags

Within the script block just add your normal code, comments, etc. The only issue you’ll have is being able to indent the text and make it look pretty. Tab doesn’t help; you’ll need to use spaces (the horror!).

Don’t use the Rich Text Editor
Important! Always use the Source Editor function to manipulate your code, or any other content within the same CEWP. If you use the Rich Text Editor at any point it will delete all your script.

Linking to Javascript source files

Sometimes your javascript code may be a little too long to embed. Or, like me, you’ve been burnt once too often by clicking the Rich Text Editor button by mistake. At such times you might prefer to link to separate javascript files rather than embedding all directly.

To link to a separate file:

  1. save the Javascript content as a separate .JS file and upload to somewhere on your site. I tend use a /scripts subfolder within the default documents library.
  2. add/edit your CEWP to reference the script file:
<script type="text/javascript" src="full path to script file"></script>

For example, here’s a CEWP that includes a separate Javascript file and then references a function (presumably) defined within it.

Hacked

Just discovered this website had been hacked. First clue was when the site got banned by a corporate web filter as “adult material”. Unless someone had posted a particularly vitriolic comment that was unlikely.

I won’t provide any more oxygen to the hackers over what exactly happened, but here’s the steps taken to get back online.

(1) Run to Google

As always, find a friend who’s been through it before. In particular these two pages proved useful.

First steps taken after reading them (and they explain more about each step):

  • change passwords (for both wordpress and mySQL)
  • setup secret keys and salts
  • check .htaccess
  • delete all unused themes

(2) Install the exploit scanner

There is a plugin available that can help check for suspicious code:

http://ocaoimh.ie/exploit-scanner/

Follow the provided instructions to install.

When I ran the scanner it located dodgy code in a plethora of files. Comparing those files to a (sadly) old backup I discovered they were not part of the original wordpress installation. They also, suspiciously, all had an identical and recent install date/time.

Therefore next step was to delete them all. And that did most of the work. I got my site back. Almost….

(3) Fix the theme

After deleting all the extra files, the site was almost back. It now did not show the “you’ve been hacked page”. But instead it showed the contents of my theme’s CSS file. Obviously some corruption in there somewhere.

First step was to temporarily install a basic theme and switched to that. All worked well and my site was back up and running. Just ugly(er). To improve I then deleted the corrupted theme and re-installed from a backup. And everything was back to normal.

Conclusion

Thankfully my intrusion proved quite simple to remove. Whether I removed every element we’ll find out in the next days as we see how long the site stays up. However lessons learnt are quite simple:

  1. get a recent/regular backup (of content and data). Having another folder listing what files should be there proved invaluable in quickly deleting what was added.
  2. keep up to date with releases.
  3. if you’re site suddenly gets blocked by a web filter, don’t blame a rude commenter!

UI Rule #92 – Don’t sacrifice the useful to fit your design

Everybody needs a lego moleskine. Comparison shopping at the UK Book Depository proved troublesome because they decided to cut the product title short, removing the information that actually differentiated the products being chosen:

Hard to tell which one to choose when everything you want to know about the choices is unavailable. Should I get the “Lego Y..” or, mmmmm, the other “Lego Y..”?

Compare to Amazon, who manage to fit the full name in without issue:

If you’re going to allow a certain number of characters for a value, assume all of those characters may be important at some point. And make sure somewhere on your interface you let them all get their moment in the sun.

Want your iPad calendar to start the week on Monday? Move to Namibia

Frustratingly, my iPad calendar appeared to unilaterally decide that the first day of the week was Sunday. And there was no obvious setting to change it, like there is for Calendar on the Mac.

Turns out this “feature” is decided by Apple based on your region. They believe Australian weeks start on Sunday so that’s the way it is. To change the day, change your region.

For Australians wanting their calendar to start on a Monday:

  1. Launch settings
  2. Select General > International
  3. change region format to Namibia

This bizarre choice seems to have the best option for calendar setting, as well as changes it makes to keyboards (what currency symbol you see), date and time formats, even which google you default to when you search. Namibia appears to leave all the other settings “just like Australia”, and still default to google.com.au for searching in Safari.

Thanks to the clever chaps on the Whirlpool forums, particularly dokh22, for uncovering this. Now how long before Apple gives us a calendar setting to do it properly?

Shipping is part of the product cost

When shopping online, while comparing product costs is important, often what I need to compare is the total ‘cost-to-the-door’. This is particularly the case when shopping at overseas sites – something those of us in Australia do most of the time.

Different sites/vendors have different rules about shipping. And the variations in shipping options can easily negate any variation in original price.

So as a general request to web store developers and vendors, please allow visitors to determine the shipping cost prior to checkout and/or prior to registration. Don’t make me sign up and complete all my mailing details before I can determine the actual price.

How to do it

Really have two options if wanting to be upfront about shipping costs.

(1) Include shipping in the initial cost

This is the UK Book Depository model. One price is quoted for any item. And that price includes delivery.

Quoted cost = final cost to my door. Simple.

Note technically the site states delivery is free worldwide. But we all know that really means they just include it in the initial price. That’s why they’re not the cheapest on first quote. But the convenience of knowing the final price up front far outweighs any interest in comparing with other stores. I’m not going to search for the same book in Amazon (for example), add to basket, check out, log in, enter shipping details, etc, just to get a price to compare with the first number offered by UK Book Depository.

Another consequence of including delivery in the initial cost is it removes any order friction around postage optimisation and bundling. For example, Amazon postage appears to get cheaper the more books I order, with the consequence that if I want a book I’ll add to my basket but not actually order until a few more items in there to lessen the postage overhead. But then what actually happens is they sit there long enough for me to lose interest and remove them. With UK Book Depository there is no benefit in bundling orders together. Which means all orders get submitted immediately. Before I’ve had time to reconsider.

(2) Provide a mechanism to quickly determine shipping costs

Simple tool to estimate shipping. Close enough is good enough at this stage of the purchasing process.

If shipping cannot be bundled, then allow me to calculate (or at least estimate) the shipping before entering any personal information. How much do you need to estimate shipping? Nothing more than a zip/post code and/or country. And I won’t be upset if I have to enter that twice; once to estimate and once to actually checkout.

For example, look at how Think Geek does it. As soon as I add an item to my basket, I get a simple shipping calculator. This gives me a figure close enough to the final value that I can immediately determine whether to progress with the order or not.

How not to do it

Already stated what not to do: don’t make me complete all my order details before I get a figure for shipping.

Don’t make me sign my life away before quoting postage.

To that essential rule, I’ll add an extension particular to us overseas buyers. Don’t make me complete all my order details before you tell me that you cannot ship the requested item to me. Too often some protectionist racket prevents requested items being sent overseas. Nothing more annoying than completing your forms before being told “sorry, not available in your country”.