Thursday, September 8, 2016

CarFlix (Or: netflix for the car)

Ok, so this post is not really about SharePoint at all... but a day to day challenge I recently had to face in my personal life.

Last week I replaced my car to a new car that didn't have a DVD player.

I knew the kids won't like it, and I was determined to find a better solution than an after market DVD player for the car.

The problem with these, you see, is that the kids have to constantly drive me crazy with which DVD to put in, change it, press play, stop, skip, volume, or find the movie they want to watch.

That had to stop.

Then I was thinking, you know where we don't have that problem? At home. Since the kids can use their iPads to watch Netflix or shomi (in Canada) and switch between movies and shows as they please with no need for those pesky DVDs, which we buy only for the car.

But, I didn't want to kids eating up all my data plan on my phone while we were on the road...

So, I was looking for this setup:
1. Some storage that I can rip my DVDs into movie files and store on it
2. Some sort of wifi hotspot router that I can put in the car to create a personal wifi network
3. Make the storage available on the wifi network
4. Install some sort of media server that would serve the content from the storage device

Now, I said to myself there is no way someone built all that so I started looking at raspberry pi as a way to build such a setup myself, which I was able to figure out and with a lot of hard work and about 400$ would get it up and running. Only one problem: it would shut off abnormally when cutting the power, and the OS might not like it and fail, which will require keyboard and screen to fix such issues.

Well, the answer came from an unexpected search. I looked up Plex media server, and in one of the docs I found that some NAS storage devices can run a Plex server right on them (#1+#4).
I started reading on that and found that a WD NAS can run Plex and also have WiFi built in.

I started reading on "WD My Passport Wireless Pro" and found this amazing model:
"WD My Passport Wireless Pro WDBSMT0030BBK - Network drive - 3 TB"

Now, here is what it has:
1. 3TB of storage
2. Built in WiFi that creates a hotspot
3. Plex server installed
4. All day battery
5. USB charger

Basically, everything I was looking for and much more! The battery was a huge plus.

I bought it, copied some of the DVDs to it, set up the Plex server and configured the WiFi hotspot - all using my iPhone without hooking it up to the PC even once.
It was a breeze, easy, simple, and things just worked (a reboot after installing Plex was needed to sort it out).

Now, when we are in the car, the kids iPad can connect to the "CarFlix" WiFi, open the Plex app in their iPads (or use the browser) and watch whatever movie they wanted.

So, this is my "CarFlix" setup. What do you think?

P.S. I found the cheapest deal that was in stock from Dell Canada's web site. Everywhere else it was out of stock for months: http://accessories.dell.com/sna/productdetail.aspx?c=ca&l=en&s=dhs&cs=cadhs1&sku=A8995570

Tuesday, April 19, 2016

KWizCom Forms external values explained

Sharing the slides of my webinar tomorrow, April 20 at 2 PM.

Join the webinar - click here

Upcoming webinars - click here

A short presentation explaining how external values work in KWizCom Forms behind the scenes, as well as how to build and publish new services and connect your form logic to LOB systems.





Hope you enjoy the webinar!

Monday, April 4, 2016

Heads up - SP2016 developers

Upgrading full trust solutions from SharePoint 2013 to SharePoint 2016 (still in beta)

Background

During preparations for all our full trust products to support SharePoint 2016, I came across a few gotcha moments.

I must say, the vast majority of things just worked as is on SP2016 without any need for change in our code or packaging from SharePoint 2013.

Even the fact that the layouts URL is still _layouts/15 and not _layouts/16 didn't seem to fool our code, since we noticed O365 is running 16 version but still uses /15 in its URL path.

That said, we did have a couple of issues and these are things you can do today in your code to make sure you are ready for SP2016 upgrade.

Also, although it is a bit early to know for sure, but SharePoint 2016 really feels more like an update than an upgrade. Packing a lot of usability enhancements and UX enhancements, at the very core it looks and feels like SharePoint 2013 with many enhancements, which in my book is way better than re-writing the entire UI from scratch every time, don't you agree?

Anyway, here is a short list of things that we did need to change in our package:

Changes needed

Beware of non-API JavaScript functions

Like many other good SharePoint developers, we are, too, lazy in our core. Being a lazy developer is a good thing since you always try to use, reuse and recycle what the environment gives you before trying to write it yourself.
However, I have noticed many functions that were available as part of SharePoint core, init or other JavaScript files are now missing in SP2016. Probably, due to some sort of cleanup process done by the SharePoint team on functions that were no longer being used by the product itself.
For instance, many SharePoint examples on how to get the selected items in a SharePoint list view had the following code:
var selection = SP.ListOperation.Selection.getSelectedItems(context);
if (CountDictionary(selection) > 0)
CountDictionary was a function defined in inplview.js however this function is no longer available in SP2016.
As a general rule of thumb, MS does not recommend you rely on any JavaScript function that is not under the "SP" namespace, as they are not intended to be a part of the product's public API. In other words, if it does not start with "SP.*" don't use it.
For this specific example, it is safe to just check the selection.length since getSelectedItems seems to return an array.

SharePoint Versioned Paths

This one is tricky. Make sure you got your code logic right on this one.
When using any path under _layout, SharePoint 2016, v16, uses _layouts/15. The Same path as SharePoint 2013, v15.
But, when probing for files on the SharePoint root folder, SharePoint 2016 uses the 16 sub folder, not the 15.
In our logic, we check if the SharePoint version is 15 or greater, use _layouts/15 and as for the file system - we recommend you use the Microsoft.SharePoint.Utilities.SPUtility.GetVersionedGenericSetupPath API to get the correct folder.
If your code needs to be compatible with SharePoint 2010 and the above method is not available in the API, use reflection to call it. Here is a code example:
try { 
var method = typeof(Microsoft.SharePoint.Utilities.SPUtility).GetMethod("GetVersionedGenericSetupPath");
if (method != null) {//does not exist in sp2010
var result = method.Invoke(null, new object[] { folderPath, Constants.SharePointConstantsBase.SP_Version }) as string;
if (!string.IsNullOrEmpty(result)) return result;
}}catch { /*handle code in case function is not availalbe*/ 
return SPUtility.GetGenericSetupPath(folderPath);}

Top bar changed its name

If you are planning to hide or manipulate the top bar area, this is perhaps one of the most noticeable changes in SharePoint 2016. In your code, if you have referenced it using document.getElementById("suiteBar") you will now need to check if it does not exist, look for it with its new ID: document.getElementById("suiteBarDelta")

Our custom master page crashed

This one, I am not sure why did it happen or what technically has changed. But, our custom master page that we use for some settings pages crashed on SharePoint 2016. The fix was hard to find, but simple to implement. For some reason, it would not work unless we added this code to the top of the master page:
<%@Master language="C#"%>
You will see this is added to the SharePoint OOB master pages as well.

User Profiles and other services

Needless to say, if your product rely on some other SharePoint farm service like the user profile - you will probably need to redo these parts and fit them to SharePoint 2016. I noticed a few differences in the API for the user profile service, as well as a change in the DataBase schema in case you were probing that as well.

Client side OM

As for CSOM, it is pretty safe to say everything from SP2013 works on SP2016, with more things supported on 2016. I will write another post going from O365 apps and making them work on SP2013 which will cover some CSOM gaps you might notice going the other way around, but moving forward (upgrading) I didn't encounter any code to stop working, except for more heavy throttling being done on O365.

I hope this post helps, feel free to leave comments below