October 13, 2017

Toilet paper price calculation

Compare prices of toilet papers with this handy chart. 

August 1, 2017

UNMS on Azure

Below are the bare minimum steps to install Ubiquiti’s Network Management System on a Docker container on Azure Ubuntu VM. After adding my ER-X-SFP v 1.9.7 to UNMS, I can now see it on the UNMS console.

  1. Create new VM "Docker on Ubuntu Server"
  2. clip_image001

    1. For VM Size, I used Basic A1, which nearly corresponds with the requirements for RAM (1.75GB vs 2 GB)
  3. Connect to VM using Putty
    1. Username and pwd are the ones you typed in when creating the VM
  4. Update Ubuntu to 16.04.1 (or newer)
  5. $ sudo apt-get update
    $ sudo apt-get dist-upgrade

  6. To check upgrade succeeded, run
  7. $ lsb_release -a

  8. According to UNMS installation steps at https://github.com/Ubiquiti-App/UNMS/wiki/Installation-%26-Update run commands
  9. $ curl -fsSL https://raw.githubusercontent.com/Ubiquiti-App/UNMS/master/install.sh > /tmp/unms_install.sh && sudo bash /tmp/unms_install.sh

  10. Add HTTP endpoint to Azure VM, optionally allowing it only from your IP address
  11. Connect to UNMS using browser at http://xyz.cloudapp.net
  12. In UNMS Settings, I changed the “Ping Address” to ping.ubnt.com as suggested at https://community.ubnt.com/t5/UNMS-Ubiquiti-Network-Management/ICMP-blocked-to-UNMS-in-Azure/m-p/2007979#M219

Optional modifications

In addition I changed UNMS Inform port using the following command, and added endpoint to Azure to allow it from my home IP.

$ sudo bash /tmp/unms_install.sh --ws-port 8444

I also added CNAME to my DNS provider to access UNMS using my my own domain name. In UNMS settings at Settings –> UNMS I added this custom domain name unms.mydomain.com to “UNMS Hostname/IP”.

 

May 2, 2017

Office Online Server on Windows Server 2016: 'InkandHandwritingServices' was not found

Problem

When installing Office Online Server on Windows Server 2016, and using the Add-WindowsFeature script provided on all of the installation instruction articles, such as this, you will get error

Add-WindowsFeature : ArgumentNotValid: The role, role service, or feature name is not valid: 'InkandHandwritingServices'. The name was not found.

Solution

Windows Server 2016 doesn’t contain Ink And Handwriting Services, so omit that from the Add-WindowsFeature command. So, working script for WS2016 is:

Add-WindowsFeature Web-Server,Web-Mgmt-Tools,Web-Mgmt-Console,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Static-Content,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-WCF-HTTP-Activation45

March 31, 2017

SharePoint: Workaround for Script Editor and Chrome ERR_BLOCKED_BY_XSS_AUDITOR

Problem

In recent Chrome browser, it has become little annoying to work with SharePoint tool due to Chrome throwing ERR_BLOCKED_BY_XSS_AUDITOR error when working with the Script Editor web part. This is due to XSS auditor on Chrome blocking JavaScript included in the Script Editor Web Part. Issue occurs on SharePoint Online and on-premises SharePoint 2016 and 2013 and occurs regardless if site is accessed via HTTP or HTTPS.

Steps to repro:
  1. On SharePoint publishing page, add Script Editor web part to content area or web part zone
  2. Add the following code to the web part (any JS will do the trick): 

    <script>
    console.log("asd")
    </script>

  3. Click Insert at the bottom of the Script Editor content dialog
    --> Chrome throws you to page saying


    This page isn’t working

    Chrome detected unusual code on this page and blocked it to protect your personal information (for example, passwords, phone numbers, and credit cards).
    • Try visiting the site's homepage.
    ERR_BLOCKED_BY_XSS_AUDITOR

Workaround

You can disable the XSS Auditor by appending the following value to web.config on your on-premises SharePoint 2013 or 2016 web site.

  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-XSS-Protection" value="0" />
      </customHeaders>

For SharePoint Online, there is no workaround at the moment.

March 21, 2017

SharePoint: Getting list items with SPFx and CamlQuery

Problem

When fetching SPList items using SPFx and REST combined with CAMLQuery, you need to use spHttpClient.post. However, the following code wasn’t working:

const options: ISPHttpClientOptions = {
	body: `{'query': {
		'__metadata': {'type': 'SP.CamlQuery'},
		'ViewXml': '<View><Query><OrderBy><FieldRef Name="ID"" /></OrderBy></Query></View>'
	}}`
};

return this.context.spHttpClient.post(window.location.protocol + '//' + window.location.hostname + (this.properties.webUrl +
	`/_api/web/lists/GetByTitle('Pages')/items?$select=Title`),
	SPHttpClient.configurations.v1,
	options)
	.then((response: SPHttpClientResponse) => {
		return response.json();
});

But instead it was throwing errors such as:

The property 'query' does not exist on type 'SP.Data.PagesItem'. Make sure to only use property names that are defined by the type.

or

An entry without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.

Solution

First of all make sure you use the “odata-version: 3.0”, but more importantly, as you’re using POST, change the REST URL from …/items to …/GetItems.

Final working code:

const options: ISPHttpClientOptions = {
	headers: {'odata-version':'3.0'},
	body: `{'query': {
		'__metadata': {'type': 'SP.CamlQuery'},
		'ViewXml': '<View><Query><OrderBy><FieldRef Name="ID"" /></OrderBy></Query></View>'
	}}`
};

return this.context.spHttpClient.post(window.location.protocol + '//' + window.location.hostname + (this.properties.webUrl +
	`/_api/web/lists/GetByTitle('Pages')/GetItems?$select=Title`),
	SPHttpClient.configurations.v1,
	options)
	.then((response: SPHttpClientResponse) => {
		return response.json();
});

Oh, and no need to use JSON.stringify() when building the ISPHttpClientOptions body query, just use ` around the code and it will already be a string.

March 17, 2017

SharePoint: Make form Cancel button to not redirect to Source URL

Problem

On a feedback form implementation, you can make the SAVE button redirect to any page you wish using the Source Query String parameter. But how to make the CANCEL button to not redirect to this same Source page, which is commonly a “Thank you” page?

Solution

  1. Create new “New” form for the list.
  2. Find SharePoint:GoBackButton control
  3. Add new parameter RedirectUrl with the URL where Cancel button should redirect to.

In my case it is just redirecting to the front page of the site.

form1

March 9, 2017

Sonera IPTV on Ubiquiti EdgeRouter

Network details

eth0 = internet
eth1 = LAN
eth0.252 = IPTV VLAN
LAN subnet = 192.168.1.0/24

 

Steps

1. Add new VLAN interface

clip_image001

2. For interface MAC, set MAC of your Inteno router (not sure if this is needed)

clip_image002

3. For interface DHCP / route settings set the values

clip_image003

4. For firewall create address group IPTV for multicast traffic

address-group IPTV 
{
address 239.16.116.0/24
address 239.16.117.0/24
description ""
}

5. For firewall, create two rules: IPTV_IN and IPTV_LOCAL, assign to eth0.252/in and eth0.252/local

name IPTV_IN 
{ 
default-action drop 
description "" 

rule 10 
{ 
action accept 
description "Allow established/related" 
log disable 
protocol all 
state 
{ 
established enable 
invalid disable 
new disable 
related enable 
}
} 

rule 20 
{ 
action accept 
description "Allow multicast" 
destination { 
group { 
address-group IPTV 
} 
} 
log disable 
protocol udp
} 

rule 30 
{ 
action drop 
description "Drop invalid state" 
log disable 
protocol all 
state { 
established disable 
invalid enable 
new disable 
related disable 
}
} 
} 
name IPTV_LOCAL { 
default-action drop 
description "WAN to router" 

rule 10 
{ 
action accept 
description "Allow established/related" 
log disable 
protocol all 
state { 
established enable 
related enable 
}
} 

rule 20 
{ 
action accept 
description "Allow multicast" 
destination { 
group { 
address-group IPTV
} 
} 
log disable 
protocol udp 
source { 
} 
} 

rule 30 
{ 
action accept 
description "Allow IGMP" 
log disable 
protocol igmp
} 

rule 40 
{ 
action drop 
description "Drop invalid state" 
log disable 
protocol all 
state { 
invalid enable
} 
} 
} 

6. Done!

Keywords: Sonera Viihde, Fibre, Fiber, sonera viihde iptv omalla reitittimellä