Thursday
Nov032011

SharePoint Popup Contextual Images

Also known as the 'hover over for screenshot' functionality.  This is a nice jquery driven code snippet that will take any link on your SharePoint page that has an image as its url and allow the user to simply hover over the link to see the image.

This has come in handy for providing contextual help in the form of screenshots right in with content.  A dead simple implementation might look like the following with a hyperlink column in your list and that being the only element in the view.

Yielding this type of thing when you hover over a link on your page:

Otherwise this just requires a reference to your local jquery file (or maybe not local, do what you want cowboy).


<script type="text/javascript" src="jquery.min.js"></script></span></div>
<script type="text/javascript"></span></div>
<br /></span></div>
function imagePreview(){</span></div>
arrOfImageTypes = ['jpg','jpeg','gif','png'];</span></div>
 $("table.ms-listviewtable td.ms-vb2 a").hover(function(e){</span></div>
 var href = this.href;</span></div>
 var img = href.substring(href.lastIndexOf('.')+1).toLowerCase();</span></div>
 if(href.indexOf('http')==0 && $.inArray(img,arrOfImageTypes)>-1){</span></div>
    $("body").append("<img id='preview' src='"+ this.href +"' alt='Image preview' />");</span></div>
 }</span></div>
 var obj = $("#preview");</span></div>
 var offset = $(this).offset();</span></div>
 var winHeight = $(window).height();</span></div>
 var winWidth = $(window).width();</span></div>
 var scrollLeft = $(window).scrollLeft();</span></div>
 var scrollTop = $(window).scrollTop();</span></div>
 var objHeight = obj.outerHeight();</span></div>
 var objWidth = obj.width()+15;</span></div>
 if(((winWidth+scrollLeft)-offset.left)<objWidth){</span></div>
 offset.left=((winWidth+scrollLeft)-objWidth);</span></div>
 }</span></div>
 var maxHeight = (winHeight+scrollTop)-offset.top;</span></div>
 if(objHeight>maxHeight){</span></div>
 if(offset.top-scrollTop>objHeight){</span></div>
 offset.top=offset.top-objHeight-20;</span></div>
 }</span></div>
 height = (objHeight<winHeight)?objHeight:winHeight;</span></div>
 }</span></div>
 obj.css({"position":"absolute","top":(offset.top+20)+"px","left":(offset.left+20),"border":"1px solid black"})</span></div>
 .fadeIn("fast");</span></div>
 },</span></div>
 function(){</span></div>
 $("#preview").remove();</span></div>
 });</span></div>
};</span></div>
<br /></span></div>
// Call the script on page load</span></div>
$(document).ready(function(){</span></div>
 imagePreview();</span></div>
});</span></div>
</script></span></div>
Tuesday
Oct112011

Google Stock Ticker for SharePoint

We looked at a number of controls to add a stock ticker to our intranet after it was requested that we do so. We looked at a few paid versions, considered building our own and in the end settled for using Google's phenomonal API for stock data.  Sure it is 15 minutes delayed so day trades should go find a version that you pay for.

Sample yerself some XML results here: http://www.google.com/ig/api?stock=.INX  You'll see in line 275 of the attached web part where the call to Google's API lives and can me modified.

SharePoint comes with a great data view web part that we just fed the Google output into, did a little visual tweaking to meet the space constraits we had and we were done.  Elegant, reliable, cheap.   Win.

I attached the exported web part that we used that you can import as a starting point if you'd like or if you want a little more control you can just build your own and not spend much more time in the process.

stock_ticker.webpart

Tuesday
Oct112011

Blog Reboot

Well, I've finally decided to attempt this again.  I think a portion of my reluctance to pick the effort back up was in managing my local instance of WordPress so I made a clean break to SquareSpace and put my money where my mouth is.  I've been recommending them to others for years now and even done a little freelance work on the platform.

I am generating some code at work that may prove helpful to others and have decided that I need to get it out and available to others, giving back to a community that I have been playing a one-sided game with for a while now.

I'll save a few posts from my old blog but plan on letting many of the others go, like old friends that you remember fondly but realize you may be better off with memories of than bumping into every few years.  I'm keeping the blog name though as I feel I never gave it attention enough to do it justice.  Here we go.

Tuesday
Sep202011

Um, Google, this isn't working

Scenario: My daughter, under 18, has been using Google Buzz to communicate with her friends now since it came out because we will not let her have a Facebook account yet.  Facebook is not a organization that I feel has the user's best interest in mind.  Google though I feel more comfortable with as she has a very level head on her shoulders.  Although none of us adults were using it, what I've come to learn is that apparently Buzz is the shiznit for the young folks.

So, Google is now killing the Buzz service that anyone could access, regardless of age and is barring young folks from using Google Plus.  The solution is that, en masse, they all open new Google accounts with fake ages.  This strikes me as bad for Google and not really what I would, as a parent, advocate.

So my daughter discussed this with me, we talked about social networking and have discussed sensible online behaviour for years now and asked me to help her get Google Plus enabled for her.  I think she is mature enough to handle this model, but Google locks you out really well, your only recourse is to wait until you turn 18.  No ability for a parent to override or opt in.

So now she has a bogus account just to interact over plus.  What did they expect?  They are inviting a huge user base to provide them with incorrect information that we all know they use for marketing purposes so protecting the integrity of that data seems like it would be a high priority.  Locking the service down to 18 years of age is asking for bad data.  This isn't working guys.

Tuesday
Feb052008

Starting a Family Wiki (Before it is too late)

My long term memory is, well, OK at best. This is not a new development and the age of electronics has enabled me to store the information I want to remember and access it easily so this is not a debilitating personal shortcoming. I’ve embraced it, or at least compensated for it, reasonably as I accepted it and tools evolved.

Years ago my wife and I started recording (on paper) and placing in a box all of the memorable quotes that our children said so we would not forget them. Within a few days of a great quip we always seemed to have trouble remembering exactly what was said. So a decade later we had a treasure trove of hilarity scribbled on scraps of paper stating what someone said, when they said it and what the context was.

I was already using MediaWiki to store notes and pieces of code that I’d written over the years giving me an easy and convenient way to index and refer to that info when we decided to do the same for family info we did not want lost to faulty memories. [Update from 2011 - I have since migrated to ScrewTurn Wiki as it allows for a text-file-only storage mechanism which seems like a good long term bet to be viable in decades to come.]

We have now been running a family wiki for over a year now and have piles of great information stored away for ourselves in later life or our children or grandchildren to refer to. The wiki format allows us to write a little bit about teachers (favorite and otherwise), crushes, art projects, first roller coasters, what people dressed as for Halloween, what we did on family vacations, favorite family recipes, poems written for school, who coached the basketball team in ‘06, great family practical jokes, those quotes and sayings that everyone has, and ten thousand other things that will be wonderful to flip through and remember in a few decades.

We’ve affectionately named ours the Clio Project in honor of the Greek Muse Clio, the Muse of memory. Now ‘to Clio’ something is a common verb. Well kind of common…

With some dedication the Clio Project is turning into a family treasure as increasingly more information is finding its way into an electronic format anyway and flowing into our data store. MediaWiki supports pictures, files, version control, categories, discussions (handy when my oldest disagrees with my assessment of any given item) in addition to passwording and overall site-access control.

So start early, having great moments documented from their beginning would be a great gift to give your child or grandchild one day. I wish the technology was around back when we started ‘The Box’ as much of the great details over those years have already faded or are fading rapidly now. I’ve found that if you take just 30 minutes a week to make an entry on some topic and it starts to accumulate pretty quickly.

I’ll end this post with a favorite entry from our wiki, from the category ‘Quotes’:

Kevin asked [son] if he wanted a hard-boiled egg for a snack:

[son]: No, I don’t like eggs (pauses) except when they are in cake.

6/17/2005 – [son] almost 5 years old.