Wednesday, March 22

Fix:Windows 10 ( Not finding Linux Workstations )


The Problem

Recently I ran into the problem where most of the machines on a network could see the linux server by network name. The two computers which could not see the linux samba file server are both running Windows 10.

While using my google ninja skills I came across many other people who were having the same problem. Some of the people attributed the issue to Samba on linux. Other people said it was Microsoft's implementation of the SMB protocol. Yet others, like myself, were just puzzled.



The Fix

On the Windows 10 computer start powershell. You can search for powershell by holding down your windows key and pressing the letter "S". Typing "powershell" into the search box will after a brief moment present "Windows PowerShell". Right click on "Windows PowerShell" and select "run as administrator".


  1. Turn on SMB 1.0 support
    • sc.exe config lanmanworkstation depend=bowser/mrxsmb10/nsi
  2. Disable SMB 2.0
    • sc.exe config mrxsmb20 start=disabled


Revert Fix

If you need to reverse the previous fix for any reason.
  1. Add SMB 2.0 support
    • sc.exe config lanmanworkstation depend=bowser/mrxsmb10/mrxsmb20/nsi
  2. Start SMB 2.0 support on boot
    • sc.exe config mrxsmb20 start=auto


Updates

  • 17.03.28 
    • Changed title to be less "clickbate/clickbatie/clickbaty"???
      • From: "Fix: Windows 10"
      • To: "Fix:Windows 10 ( Not finding Linux Workstations )"

Monday, March 20

Fetching value from nested object, or null ( JavaScript )


Introduction

A simple function which will safely return the value or null from a nested set of objects. With this function it makes it much easier for you to know that you are always either going to get the existing value, or if that object path does not exist, you will get a value of null.






Source Code

Example Data - JavaScript (ES6)

var savedata = { data: { users: { username: { name: 'first last', pass: 'password' }, test: { name: 'test user', pass: '12345' } }, version: '17.03.20' } } ;


Source Code - JavaScript (ES6)

const getVal = ( obj, path ) =>
   path.reduce(
       ( child, prop ) => child && child [prop] ? child [ prop ] : null, obj
   );

console.log( getVal( savedata, [‘data’, ‘users’, ‘username’] ) );
// [ ‘cool’, ‘yup’]

console.log( getVal( savedata, [‘data’, ’user’, ‘bob’] ) );
// null



Source Code - Javascript ( ! ES6 )

function getVal( obj, path ) {
   return path.reduce(
     function ( child, prop) {
       return child && child[ prop ] ? child[ prop ] : null;
     }, obj
   );
};