Commenting multiple lines in Power Shell

In one of my recent blogs I talked about how to comment code in PowerShell. That was by using a Hash Tag or a Pound Sign. But what if you would like to comment out multiple lines of code? It would be Inconvenient to Add a Hash Tag against each line of code that you want to comment out. That task is cumbersome and time consuming. Fortunately many programming languages and scripting tools have a way of commenting out multiple lines of code.

In Power Shell, one could comment out multiple lines of code by just following these steps-

You can start the comment block by adding this <#  to the code. And it can be ended by  this #> For Example, this would be the way to comment out a block of code.

 

$a=5

Write-Host "Initialized a variable"

<# $b=2

Write-Host "Initialized a second variable" #>

This example comments out code starting from the place where the variable b was Initialized.

 

 

 

Advertisements

Windows-Cannot detect external display

There may be times when you encounter situations where your laptop cannot detect an external display even though it is connected. There can be many causes for this. The obvious  is to check whether your laptop is properly connected to the external display and your monitor is powered ON.

 

The next thing is to go to your Display Settings. Open the Run Window (Ctrl+R) and type desk.cpl, this would take you to the Display Settings Window.

Screenshot (45)

Now that you are In the Settings page click on the undetected monitor.

Screenshot (46)

Scroll down and under the Multiple Displays dropdown, select Extend these Displays. Now your monitor should be back in life!!

 

Installing Node.js on a Mac

Node.js allows one to run JavaScript outside the browser. It is especially useful for running React which is a JavaScript framework. You could either Install Node.js by downloading the package from their website or use a Package Manager. Installing it via a package manager is the preferred method.

A package manager for Mac that you could use is Home Brew. In order to Install the Package Manager enter the following command in the terminal

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Home
brew/install/master/install)"


 

This Installs the Package Manager. The next step is Installing Node.js and NPM which is a package manager for JavaScript. All you have to do is type this command in the terminal

brew install node


This Installs Node.js and NPM. In order to ensure that node.js has been Installed, type this command in the terminal

node -v

If it returns a version number, it means that node.js has been successfully Installed.

Let’s summarise, there are two steps in Installing Node.js

  1. Install a Package Manager for Mac. In this case we have Installed HomeBrew.
  2. Once Installed, Install node by typing the install node command in the terminal.

 

NJ Transit-Path App-RIDEPATH

The Nj transit has finally come out with an app for Path trains. It is called RidePATH. For people who don’t know the Path trains provide service for towns in New Jersey to Manhattan. The trains run underground for almost the whole trip unless you are travelling from town on  and beyond Journal square.
The app gives  real time updates on when the next train is going to arrive. Users need to have their Bluetooth enabled in order to receive the updates.
The app was released on the App store for iPhones on Thursday and for android on friday
Here is the for the Android App

Debug Print Backtrace PHP

Debug Print Backtrace is a function in PHP. As the name suggests it traces back function calls.

For Example

1. <?php
2. function one(){

 3. two();

4. }

5. function two(){

6. three();

7. }



8. function three(){

9. debug_print_backtrace();

10. }

11. one();

12. ?>

The output would show you the list of functions that were called, starting from the last to the first function along with the line numbers

 

#0  three() called at 6
#1  two() called at 3
#2  one() called at 11

 

 

A website that helps you Install common software in Windows

A website that helps you Install common software in Windows

We have all been through this, when we try to setup our new laptop the first thing that we do is Install the basic applications that we require everyday. For Instance we would start by Installing the browsers-like Chrome, Firefox. And then probably if you have online storage accounts the Dropbox or One Drive. Each Application has got it’s own setup process where one would have to go their respective website, download an executable file and follow the wizard. A step gets repeated for each application that you Install.

Fortunately this should be a thing of the past since now there is a website called Ninite  that helps you Install all your applications at once! Forget the hassle of going through different wizards and watching an application Install. So all you need to do is select the applications that you would like to Install from the website and then everything will be taken care of. This would Install applications in the background so you don’t need to bother about going through a wizard.