Link archival: [WayBack] How to Install Node.js and NPM on a Mac:
In this article, I’ll take you through the process of installing Node.js and NPM on a Mac using Homebrew.
TL;DR
- Ensure you have installed
homebrew. - Run
brew install node.
–jeroen
Posted by jpluimers on 2019/09/03
Link archival: [WayBack] How to Install Node.js and NPM on a Mac:
In this article, I’ll take you through the process of installing Node.js and NPM on a Mac using Homebrew.
homebrew.brew install node.–jeroen
Posted in Apple, Development, Mac OS X / OS X / MacOS, Power User, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/03
A very concise way for [WayBack] how to filter name/value pairs under a registry key by name and value in PowerShell?:
$path = 'hkcu:\Software\Microsoft\Windows\CurrentVersion\Extensions'
(Get-ItemProperty $path).PSObject.Properties |
Where-Object { $_.Name -match '^xls' ` -or $_.Value -match 'msaccess.exe$' } |
Select-Object Name, Value
Thanks montonero for getting me on that path and pointing me to the hidden PSObject property which by itself has Properties, and making me find these links with background information:
PSObject being hiddenPSObject is revealed when calling Get-Member with the -Force parameter.More in-depth information:
Get-Member cmdlet gets the members, the properties and methods, of objects. To specify the object, use the InputObject parameter or pipe an object to Get-Member. To get information about static members, the members of the class, not of the instance, use the Static parameter. To get only certain types of members, such as NoteProperties, use the MemberType parameter.-ForceAdds the intrinsic members (PSBase, PSAdapted, PSObject, PSTypeNames) and the compiler-generated get_ and set_ methods to the display. By default, Get-Member gets these properties in all views other than Base and Adapted, but it does not display them.
The following list describes the properties that are added when you use the Force parameter:
Property collection, or the members that are actually properties.PSMemberInfoCollection<PSPropertyInfo>PSObject or MemberSet–jeroen
Posted in CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/03
A very subtle thing that keeps biting me as my background is from languages where by default, identifiers on the class scope are instance level, not class level:
In Python, variables on class level are class variables.
If you need instance variables, initialise them in your constructor with a
self.variable = value.
The example in the Python 3 docs [WayBack] Classes – A First Look at Classes – Class and Instance Variables is the same as in the Python 2 docs [WayBack] Classes – A First Look at Classes – Class and Instance Variables:
Generally speaking, instance variables are for data unique to each instance and class variables are for attributes and methods shared by all instances of the class:
class Dog: kind = 'canine' # class variable shared by all instances def __init__(self, name): self.name = name # instance variable unique to each instance >>> d = Dog('Fido') >>> e = Dog('Buddy') >>> d.kind # shared by all dogs 'canine' >>> e.kind # shared by all dogs 'canine' >>> d.name # unique to d 'Fido' >>> e.name # unique to e 'Buddy'
For people new at Python: the __init__ is a constructor; see these links for more explanation:
Of course, the
__init__()method may have arguments for greater flexibility. In that case, arguments given to the class instantiation operator are passed on to__init__(). For example,>>> class Complex: ... def __init__(self, realpart, imagpart): ... self.r = realpart ... self.i = imagpart ... >>> x = Complex(3.0, -4.5) >>> x.r, x.i (3.0, -4.5)
–jeroen
Posted in Development, Python, Scripting, Software Development | Leave a Comment »