Month: December 2014
Late Night Links – Sunday December 14th, 2014
Look at that! I actually managed to write late night links on time this week, even though I went out last night!
- What Happens if I Use Two-Factor Authentication and Lose My Phone?
Worth a quick read. I’ve switched from Google’s Authenticator app to Authy after reading this. - Anyone Seen a Stolen Bridge Lying Around?
- Just Park it Right Over There, Thanks!
- New “Shingled” Hard Drives Hold Terabytes for Pennies a Gig
Interesting… - Balls on an Escalator
It’s somehow mesmerising. - Take Notes at Work to Boost Your Productivity
I am terrible at taking notes. - Ford Drops Microsoft and Revamps Its Sync System for More Speed
The Microsoft Sync system we have in our car is certainly loaded with features, but also incredibly complex as a result. - Weird Bug in GTA V
- Sea of Clouds Fills Grand Canyon in Spectacular Weather Phenomenon
- Gingerbread House
- Dating Sites You Might Want To Avoid… Or Maybe Not
Flo and I joke about these whenever we see them advertised. There’s some excellent joke fodder here. - Cyanide and Happiness #3774: Google Plus
And that’s it, all done! I’m going to take a few weeks to celebrate the festive season, and I’ll see you all back here in the New Year.
Не оставяй днешната работа за утре
Translation: “Don’t leave for tomorrow what you can do today.”
The Data Visualisation Catalogue
Last week I was writing a recommendation document relating to reporting within our business unit at work. I’d done some data gathering about the current-state situation and I had a wealth of information about a large number of reports that are produced and sent out.
I needed a visual way to summarize my some of my findings.
Data Visualisation Catalogue to the rescue!
I loved this site immediately, and you just might too. You tell it what you’re trying to show, and it suggests appropriate tools.
The site is already very useful, and it’s still growing. If you want to interact with the author then twitter is your friend.
SPServices SharePoint Attachments in Internet Explorer 9
A little over eight months ago I wrote a very brief post about using SPServices to add attachments to a SharePoint list. Full credit here goes to Brendan Wilbore who wrote the blog post that I linked to.
There was a problem, though – the solution relies on the fileReader JavaScript feature which requires Internet Explorer 10, and the default browser deployed within my organization is Internet Explorer 9. What we need is a fileReader alternative for older browsers. Thankfully, such a thing exists. Today I’m going to post some example code that uses the fileReader polyfill and works in older browsers.
What You Need
The code has several pre-requisites. You’ll need jQuery, jQuery UI, SPServices, SWFObject and the JavaScript and flash file that form the fileReader polyfill.
For the purposes of my demo I created a simple SharePoint list called “File Attachment Test.” The list has a single field – title – and attachments to the list are enabled. Your list is probably named differently, so you’ll need to change the references in the code to reflect your list name.
The Code
<html> <head> <meta charset="utf-8" /> <title>File Attachment Test</title> http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js http://js/jquery.FileReader.min.js http://js/jquery.SPServices-2013.01.min.js var selectedfile = false; $(document).ready(function() { $('input#itemfile').fileReader({filereader: 'js/filereader.swf'}); $('input#itemfile').change(function(e) { selectedfile = e.target.files[0]; $('span#filename').html(selectedfile.name); $('span#fileinput').hide(); }); $('input#createitem').click(function() { $().SPServices({ operation: 'UpdateListItems', async: false, listName: 'File Attachment Test', batchCmd: 'New', webURL: '/demo', valuepairs: [ ['Title', $('input#itemtitle').val()] ], completefunc: function(xData, Status) { if (Status == 'success' && $(xData.responseXML).find('ErrorCode').text() == '0x00000000') { currentitem = $(xData.responseXML).SPFilterNode("z:row").attr("ows_ID"); alert('List item created with ID ' + currentitem); if (selectedfile) { filereader = new FileReader(); filereader.filename = selectedfile.name; filereader.onload = function() { data = filereader.result; n = data.indexOf(';base64,') + 8; data = data.substring(n); $().SPServices({ operation: 'AddAttachment', async: false, listName: 'File Attachment Test', listItemID: currentitem, fileName: selectedfile.name, attachment: data, completefunc: function(xData, Status) { alert('File uploaded'); } }); }; filereader.onabort = function() { alert('Upload aborted'); }; filereader.onerror = function() { alert('Upload error'); }; filereader.readAsDataURL(selectedfile); } } else alert('List item creation failed'); } }) }); }); </head> <body> <p>Title:<br><input type="text" id="itemtitle"></p> <p>File:<br><span id="fileinput"><input type="file" id="itemfile"></span><span id="filename"></span></p> <p><input type="button" id="createitem" value="Go!"></p> </body> </html>
Notes
The fileReader polyfill takes the file input box and puts the flash file on top of it, so that the file selection and upload is handled by flash instead of natively in the browser. I found that this fell apart of the file input box didn’t remain in the same place on the page. In other words, I had problems if I tried to use jQuery’s .show() and .hide() functions (or similar).
I solved this by putting the file selection form in a pop-up window. If the page you place your form on is static (i.e. nothing changes after the DOM is loaded) then you shouldn’t have this problem.
Enjoy!
Late Night Links – Monday December 8th, 2014
Yes, yes. I am a day late with late night links. That’s because I went to a Christmas party on Saturday night, and I am apparently not 20 anymore, as Flo pointed out. I’m back to feeling normal today, so let’s get this done.
- Search Your Email Receipts Right from Google
Handy - Monitor Santa’s Pre-Flight Prep With a Little Help From Google
I love the Google santa tracker. - How to Remove Your Mustache
- Trivia and Behind the Scenes Moments from Every James Bond Film
We have every Bond film on bluray and we got done watching them not too long ago. There are some interesting facts in here. And, while we’re on the subject of Bond, this. - Cable-Free Elevator Moves You in Any Direction
Useful. - Gangnam Style Has Been Viewed so Many Times it Broke YouTube
- Stephen Hawking Warns of the Dangers of Artificial Intelligence
Interesting interview. - Only Way to Keep it Safe
- Nexus 9 Keyboard Folio Review
I can’t decide if I want one of these or not. - Dog Fetch Fails
- Microsoft Rolls Out Support for Video Calling Between Skype and Lync Users
I’ve read previously that the next version of Lync will be called Skype for Business. - Ray Kaunisto Gets 7 Meows in an Intermission Interview
- Idiots Fighting Things
Spoiler alert: The inanimate objects are winning.
And we’re done for another week! Well, another six days in any case. I’ll try harder to be on time next week.
How Much Time Do Your Employees Spend Doing Real Work?
A survey of more than 2,000 employees found that only 45 percent of time at the office is spent on primary job duties.
Following on from my little rant earlier in the week about the concept of blocking off time on your calendar in which to do your actual job, I’ve come across the infographic in the article above.
Does this ring true for you?