Wednesday, December 25, 2013

Measured ski jump distance

Here is the answer to my question from last year: which measurement is displayed as jumped distance?
It's a bit more complicated than just putting measurement tape on the ground. Following is my interpretation of the answers I got from people in "the jumping businesses".

First 60m marking on the ground is determined with straight 60m line from the middle of the edge where jumper takes off to the side of the landing area on the ground - line B on the drawing below. The width of landing area is predetermined from geometrical standards for jumping hills and linearly increases with distance from ramp. First ground marking is where the slope of the landing area gets straight (from side view). And it is less than 60m on smaller jumping hills.
From first ground marking onward the distance is measured and added to initial 60m from projected length on the side of the landing area. This means that for each unit that jumper flies over straight beneath him on the ground a bit more is added to his result because measurement tape on the side of the landing area is put at a slight angle - line A.
Final distance is B + A. I must note that proportions on my drawings are way off. Whole jumping hill is much much longer and angles are so small that measured distances are almost not skewed (from what? :) ).

Thanks to T. Verdnik and M. Tepes for the insights!




Saturday, September 21, 2013

Switching from Atom Windows server to Synology NAS



I switched from Atom based Windows server to Synology DS413j. Following are details about my setup and some hints for problems I encountered.

HDD configuration

It seems that most flexible and extendable configuration is with using Synology Hybrid Raid (SHR). Synology has an online RAID calculator to compare different HDD configurations and show used, redundant and unused space.
It's quite useful if you want to add old drives which might not match in size for standard RAID to your configuration.
The volume on NAS can only be extended with HDD which are equal or larger than largest HDD in volume when using SHR!
Full HDD checking can take a long time!

Sharing

The folder concept is that there are common (shared) folders and user personal folders.
User folders are only visible (via any connection) to the user when the user logs in with his username. They are located in /home folder on user's root. Global user home option must be enabled for this.
Shared folders are "standalone" folders to which access can be granted for each user separately. There are some predefined e.g. "photos" and "music". Also some DSM addon application packages might make their own like "downloads" for Download station.
Now, users can also have personal predefined folders for the same purpose as shared are e.g. "photos". These are created when personal folder option per application e.g. Photo station is enabled (application must provide this option). They shouldn't be created manually.
Note how music folder is present as shared folder (selected) and as personal under home folder.

Network

A handful of ports need to be forwarded on router to access NAS from Internet. The list is available on Synology support page.

I'm using secure web access to NAS. It bothered me that web browsers warned me about untrusted site when connecting to it. And I couldn't add my domain as trusted in Chrome. So I went and got Class1 certificate from StartSSL. Class1 certificats (for personal use) are free. Guide on this blog post I found are helpful enough.
Basically you get your own certificate when you sign up and another for your domain. Acquired certificate needs to be installed on NAS and Intermediate trusted root added to operating system. It is available on StartSSL page.


It takes a while (couple of hours in my case) to get certificate after request.
You can't have multiple sub-domains registered with Class1 certificate and it needs to be renewed once per year. And of course you need to own a domain.


[UPDATE]
It's best to add the optional intermediate certificate as well. I found that Chrome browser on my Android devices showed security warning without it.



SVN

Synology released official SVN package a week before my purchase. I was using VisualSVN Server on my Windows server. While copying repository in dedicated folder on NAS was all that was needed for SVN on NAS to pick them up, there were problems with authentication. I was able to browse repository but could not commit changes. I got an authentication error. Finally I figured out that the problem was with newlines in configuration and password files in repository folder. I didn't bother with Windows to Linux conversion. I created fresh temporary repository within SVN extension on NAS, configured users and then replaced configuration files in original repository with newly created.

Popcorn Hour

I own A-210 model for streaming videos. I only use SMB. DLNA it's just not "there" for me yet.
I had to enable the predefined user account on NAS. It just had to be enabled. I left it without any permissions and Popcorn could connect with its own account.

Download station

It is awesome with Chrome extension "Download Station for Google Chrome"

Mobile apps

I use following apps on Android phone:
There are some others but I found them not useful for my usecases.

Access to personal photo folder in DSPhoto+ is achieved with additional "/~username" in app connection link. Without username it shows common photo shared folder. Some other apps have settings for common/personal folders access.

Media, Photo and Video station

Use upload utility. Copying media files directly to folders will slow down the NAS with thumbnail generation.
Utility tends to freeze. I uploaded photos folder by folder i.e. topmost folders.

WEB station

Web pages can be hosted on NAS. I don't have any yet except Wake On Lan (WoL). Below is the code for "wol.php" file which needs to be saved in web shared folder on the NAS. Then the WoL page can be accessed at nasaddress/wol.php. I have copied source from online some time ago and forgot the source to post credits.

Replace xx-xx-xx-xx-xx-xx below with computer MAC address.

<!DOCTYPE html>
<html>

<head>
<title>WOL</title>
</head>

<body>

<?php

$PCs = array
  (
array("YourPC",  "xx-xx-xx-xx-xx-xx"),
array("YourPC2", "xx-xx-xx-xx-xx-xx"),
  );

function wol($broadcast, $mac)
{
    $mac_array = split('-', $mac);

    $hwaddr = '';

    foreach($mac_array AS $octet)
    {
        $hwaddr .= chr(hexdec($octet));
    }

    $packet = '';
    for ($i = 1; $i <= 6; $i++)
    {
        $packet .= chr(255);
    }

    for ($i = 1; $i <= 16; $i++)
    {
        $packet .= $hwaddr;
    }

    $result = False;
    $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
    if ($sock)
    {
        $options = socket_set_option($sock, 1, 6, true);

        if ($options >=0)
        {
            $e = socket_sendto($sock, $packet, strlen($packet), 0, $broadcast, 7);
            socket_close($sock);
            $result = True;
        }
    }
    if ( $result )
    {
      echo "Wake on lan packet sent.<br/><br/>";
    }
    else
    {
      echo "Failed sending Wake on lan packet.<br/><br/>";
    }
}
?>

<h1>WOL by me</h1><h3> and Google</h3>
<h3>"Coz I'm awesome"</h3>

<?php
foreach ($PCs as $PC)
{
  echo "<a href=\"wol.php?mac=" . $PC[1] . "\">Wake up " . $PC[0] . "</a><br/><br/>";
}

if ( isset($_GET["mac"]) )
{
  $mac = $_GET["mac"];
  wol("255.255.255.255", $mac);
}
?>

</body>
</html>