Create SVG React components using Adobe Experience Design

Creating beautiful and responsive web designs is a challenging task. HTML5 and CSS3 are out there for a while and are powerful tools for creating responsive web designs, but there’s another great technology for creating responsive designs as well: SVG! 🙂

I’m not going to show you all the things you can do with SVG, if you like a very good introduction I can recommend Sarah Drasners Talk SVG can do that?!.

Instead I’m going to show you how you can use Adobe Experience Design as a starting point to create svg graphics, which you than can easily mold into a reusable and configurable react component. This could basically work with any other design tool, such as Sketch, Figma etc, you named it – as long they allow you to export graphics as svg.

So, let’s start. First off, we need an Adobe XD Prototype containing elements we could turn into react components. For this blog post, I’m going to use something from www.uplabs.com.

For example Nandu G created a good looking Dashboard:

Pro Stats Dashboard

Pro Stats Dashboard from Nandu G

Especially the Profile View Diagram looks like a good candiate for a svg react component. So, lets start:

To export the elements as svg we need to select the group containing the elements, right click and then “Export…”.  As Format we must choose “svg”, The other options are not relevant for this example. After clicking export we can open the svg.

The svg is straight forward, now custom namespaces or anything like that. We can take this and put it into a React Stateless Functional Component:

But this will throw some errors, for example, JSX doesn’t support xml namespaces (like xlink:href) – Namespace tags are not supported, ReactJSX is not XML. Gladly, react allow to use camelCase notation, which will render the correct xml namespace. So all we have to do is to replace xmlns:xlink with xmlnsXlink and xlink:href with xmlHref.

The next problem comes from the style tag. The style definition contains curly braces, which causes some problems because JSX uses them to insert values from the component. The best way to solve this is to simply put the css style definitions where they belong, in a css file. One other workaround is described here: https://github.com/facebook/react/issues/2250#issuecomment-229468253

So, after this little modification our react components look like this:

This will render the demo component. All we have to do now is replace static text with real values. For example, the linear gradient offset should be adjusted to show how many profile views are from new users and how many are from people who follow us already. Also, the percentage at the bottom of the component should be updated accordingly to our users. The same goes for the “New User” counter in the center circle.

So let’s add some math and curly braces and voilĂ :

Usage:


A next step could be to add some nix hover effects or animations.

As mentioned at the beginning, this exported assets are only a starting point for creating components. To make this workflow a little bit smoother here some tips:

  1. Before exporting a group from Adobe XD, create a new canvas with the height and width of this group and align the canvas to the 0,0 coordinates.
    Alignment of a canvas

    Alignment of a canvas in Adobe XD

    This yields much better translation coordinates in the exported svg. As in the example above the viewbox of the exported svg is set to viewBox=”12137 3868 440 430″, Also the Translation of “translate(12137 3868)” the first group is somewhat weird. Instead they should be viewBox=”0 0 440 430″ and translate(40 54). This trick is very helpful if you need to calculate translation in your component.

  2. The Naming of the group in the svg correlates directly to the naming in Adobe XD.  Creating the react component is a lot easier if you structure your prototype in Adobe XD nicely and give every element a descriptive name – I know, naming is a hard thing.

I created a codesandbox for this blog post sample, if you like, you can play a little bit with it.

 

Fight against Ransomware

At the moment a major risk is endangering businesses worldwide: Ransomware.

Most common types of ransomware encrypt all user’s data – wherether it’s stored on local computers or on network drives. Even unmounted network shares are not safe, as long as the user has access to it’s contents. This elevates ransomware to a high business risk.

In order to mitigate the risk in Microsoft Windows environments a couple of built in technologies help to achieve a safer Corporate-IT.

A couple of days ago I stumbled over a promising technique – published by Matt Hopton. But it involves some manually performed actions. Let’s add some PowerShell magic 🙂

This script will

  • add FSRM Windows-Feature, if required
  • configure FSRM mail settings
  • get currently known ransomware file pattern list from ThePhoton (GitHub)
  • add file screen for path given
  • create file group update script
  • create update task

Just set the settings according to your need. You can run this script several times for different $ScreenPaths, if necessary.

#region Parameters
           
[cmdletbinding()]
param(
        [Parameter(ValueFromPipeline=$true,Mandatory=$true)] [ValidateNotNullOrEmpty()]
        [string] $ScreenPath,
        # Path to be screened
     
        [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] 
        [bool] $BlockSpecialShares 
        #On detection: Block access to hidden shares (e.g. C$), too?
                           
)
                   
#endregion

#region Settings
# File screen group name
$FileGroupName = "Known Ransomware Files”

# FSRM's mail settings
$FromEmailAddress ="FileServer@MyCompandy.net"
$AdminEmailAddress = "my@mail.com"
$SmtpServer = "localhost"

# Mail content
$MailTo = "[Admin Email]"
$MailSubject = "FSRM - WARNING: Possible ransomware activity detected!"
$MailBody = 'User "[Source Io Owner]" tried to save the file "[Source File Path]" at "[File Screen Path]" on server "[Server]". This file is known for ransomware activities ([Violated File Group]). File access for this user has been denied!'

# Event body
$EventBody = $MailBody

# Auto Update FSRM File Group Scheduled Task
$AutoUpdate = $true
$AutoUpdatePath = "C:ScriptsUpdate-FsrmKnownRansomware.ps1" #Will be created
$TaskName = "FSRM - Update Known Ransomware Files"
$TaskDescription = "Updates FSRM File Group 'Known Ransomware Files'"

#endregion

#######################
# Install FSRM Action #
#######################

$fsrmStatus = Get-WindowsFeature FS-Resource-Manager
if (-not ($fsrmStatus.Installed)) {
    Install-WindowsFeature –Name FS-Resource-Manager –IncludeManagementTools
}
Import-Module FileServerResourceManager

######################
# Set  FSRM SMTP     #
######################

### Set default mail server / adresses

Set-FsrmSetting -SmtpServer $SmtpServer -FromEmailAddress $FromEmailAddress -AdminEmailAddress $AdminEmailAddress

######################
# Create File Group  #
######################

### Get known ransomware file group and create/update...
$decryptreadme = (Invoke-WebRequest "https://raw.githubusercontent.com/thephoton/ransomware/master/filescreendecryptreadme.txt”).Content
$fileexts = (Invoke-WebRequest "https://raw.githubusercontent.com/thephoton/ransomware/master/filescreenextensions.txt”).Content
$filescreengroup = @()

foreach($line in $decryptreadme.Split("`r`n”)){ if ($line -ne "”) {$filescreengroup += $line} }
foreach($line in $fileexts.Split("`r`n”)){ if ($line -ne "”) {$filescreengroup += $line} }

$FsrmFileGroup = Get-FsrmFileGroup $FileGroupName -ErrorAction SilentlyContinue
if ($FsrmFileGroup) 
{
    $FsrmFileGroup | Set-FsrmFileGroup -IncludePattern $filescreengroup
} else {
    New-FsrmFileGroup -Name $FileGroupName -IncludePattern $filescreengroup
}

######################
# Create FSRM Action #
######################

### Create command action
$Command = "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe"
$CommandParameters = "-ExecutionPolicy Unrestricted -NoLogo -Command `"& { Get-SmbShare -Special `$$BlockSpecialShares | ForEach-Object { Block-SmbShareAccess -Name `$_.Name -AccountName [Source Io Owner] -Force } }`""
$CommandNotification = New-FsrmAction  -Type Command -Command $Command -CommandParameters $CommandParameters -SecurityLevel LocalSystem -KillTimeOut 120

### Create mail notification action
$MailNotification = New-FsrmAction -Type Email -MailTo $MailTo -MailCC "[Source Io Owner Email]" -Subject $MailSubject -Body $MailBody -RunLimitInterval 120

### Create command action
$EventNotification = New-FsrmAction  -Type Event  -EventType Warning -Body $EventBody

### Create file screen
New-FsrmFileScreen -Path $ScreenPath –IncludeGroup $FileGroupName -Notification @($CommandNotification,$MailNotification,$EventNotification) -Active

######################
# Create Update Task #
######################

if ($AutoUpdate) 
{
    #Check if path exists
    if (-not (Test-Path(Split-Path $AutoUpdatePath))) {
        New-Item -ItemType Directory (Split-Path $AutoUpdatePath) 
        }
    #Check if script exists
    if (-not (Test-Path $AutoUpdatePath)) {
        $AutoUpdateScript = 
'$FileGroupName = "'+$FileGroupName+'”
$decryptreadme = (Invoke-WebRequest "https://raw.githubusercontent.com/thephoton/ransomware/master/filescreendecryptreadme.txt”).Content

$fileexts = (Invoke-WebRequest "https://raw.githubusercontent.com/thephoton/ransomware/master/filescreenextensions.txt”).Content

$filescreengroup = @()

foreach($line in $decryptreadme.Split("`r`n”)){ if ($line -ne "”) {$filescreengroup += $line} }
foreach($line in $fileexts.Split("`r`n”)){ if ($line -ne "”) {$filescreengroup += $line} }


try {
    Get-FsrmFileGroup $FileGroupName -ErrorAction Stop
    Get-FsrmFileGroup $FileGroupName | Set-FsrmFileGroup -IncludePattern $filescreengroup
}
catch {
    New-FsrmFileGroup -Name $FileGroupName -IncludePattern $filescreengroup
}'
                                
        $AutoUpdateScript | Out-File $AutoUpdatePath

    }

    if ((Test-Path $AutoUpdatePath) -and -not (Get-ScheduledTask $TaskName -ErrorAction SilentlyContinue)) {
        #Create scheduled task if update-script exists and task does not exist

        $PSpath = "%windir%System32WindowsPowerShellv1.0powershell.exe"
        $Argument = "-NoProfile -WindowStyle Hidden `"$AutoUpdatePath`""

        $action = New-ScheduledTaskAction -Execute $PSpath -Argument $Argument
        $principal = New-ScheduledTaskPrincipal -UserId "LOCALSERVICE" -LogonType ServiceAccount

        $trigger =  New-ScheduledTaskTrigger -Daily -At 7am

        Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $TaskName -Description $TaskDescription -Principal $principal

    }

}

If $AutoUpdate is set to $true, the script Update-FsrmKnownRansomware.ps1 will be run every day at 7am to update the FSRM file group with newest ransom ware file patterns.

Once a ransomware tries to save a file matching the known file group patterns all shares are set to block the originating user.

After cleaning the user’s computer, unblocking can be done by PowerShell, too:

Get-SmbShare -Special $false | ForEach-Object { Unblock-SmbShareAccess -Name $_.Name -AccountName 'ACCOUNT NAME TO UNBLOCK' -Force }

For details see Matt Hopton’s blog post.

Please remember: You have to apply this on every file server and user accessible directory. It does not prevent the encryption of a user’s client computer, nor does it eliminate the risk of infection/loss of data. Script is given without any warranty.

Work Management in SharePoint 2016

 

 

Hi Folks,

As you all remember the well known productivity feature Work Management Services in SharePoint 2013. Well, let me drop the bomb. Work Management Services is no longer with us in SharePoint 2016. As Microsoft published in September 2014, Tasks (Work Management) got removed from Office 365. I could not find the official announcement anymore, but it is referenced here (The “Sync to Outlook” button and the “Tasks” link are missing in SharePoint Online)

As you all noticed earlier this month, Microsoft made SharePoint 2016 RTM officially available to download and trial. Central Administration

I noticed that Work Management Service got removed from the SharePoint 2016 Central Administration > Manage Service Applications > New menu.

 

So I tried PowerShellWork Management PowerShell

Here is the result. I did not find any official record, and it is not in the What’s deprecated or removed from SharePoint Server 2016 list (This list is dated March 11, 2016 and it applies to the SharePoint 2016 Preview).

So in case you relay on Work Management Service in SharePoint 2013, be warned that there is no more in SharePoint 2016. It will properly be integrated in Exchange Server or maybe there is going to be a Planner on-premise version coming up.

Cheers!