Change passwords on other accounts using Terminal

In work I have multiple accounts with security requirements making me change the passwords every 90 days. Normally with Windows I used to use CTRL+ALT+DEL and select the change password option. However on Mac OS X it’s not as straight forward… or is it? Using Terminal you can switch into any account by typing:

su yourAccountName

You will be prompted to enter the password for yourAccountName.

Then you can change the password for this account by typing:

passwd

You will have to enter the old password, then your new password and then repeat your new password.

Done…

Source:

How to switch between users on one terminal?
Change password on root user and user account

OS X Default Apps Not Changing

I ran into another weird issue during my first week with my MacBook Pro, for some reason I couldn’t change any of the default apps. Since this is my work laptop I wanted Outlook to be my default email client not Apple’s Mail.

However, it turned out I needed to reset my default app preferences as the preferences file had become corrupt! Use the following command in terminal to do it:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -all local,system,user

Worked great for me:)

Source: Unable to change default email application

What is Idempotence?

Got asked this question the other day and my mind pulled a blank on me. However an idempotent method is really straight forward. It’s just a method that no matter how many times its called the result state will always be the same, you can call the method many times without concern.

A good example of an idempotent method is the close() method on a data connection, you call it once, it closes, you call it a second time? Still closed, a third time? You get the idea.

This answer on the question of “What is idempotence?” on Stackoverflow explains it really well: http://stackoverflow.com/a/19320202/1445352

Resource: https://en.wikipedia.org/wiki/Idempotence

Update Node.js on a Windows Machine

Since most people are doing front end development on a Mac or are running Ubuntu updating Node.js on Windows seems to be forgotten about on most tutorials or accepted answers on Stackoverflow.

So here it is, download the latest MSI from the Node.js website (and install!) and then run the following commands on CMD Prompt.


npm cache clean
npm update -g

Source: Upgrading Node.js to latest version

JSPM is not recognized as an internal or external command or command not found

This drove me mad, while following the aurelia getting started guide I got as far as adding my GitHub credentials to API requests before I realised the terminal window or command prompt couldn’t see JSPM.

Everything pointed to the PATH variable not being set correctly but from what I could see everything was. In the end through some persistent searching I found this post: JSPM not working from command prompt.

And to develop a little further on that solution adding %appdata%\npm to the windows environment variable PATH solved the issue entirely.