Opening a Folder from a Terminal on Mac

Terminal in Mac is like the Command Prompt in Windows where one can access directories and sub directories. Sometimes when you are in the middle of some level of the directory structure, you might want to take a look at the folder.

In order to open the current folder from the terminal, one would have to type this command-

open .

Screen Shot 2018-02-05 at 6.43.48 PM.png

Advertisements

C# Negating a Forward Slash by a Back Slash

Forward Slashes and BackSlashes have different Interpretations in programming languages.  For Instance in C#, the Back Slash is used for commenting out Code. So, if you want to comment out code  in C#, you would do something like this-

// int test_variable=5;

That is two forward slashes at the beginning of the line. This is all and good until one works with URL’s.

Everyone knows that a complete URL would appear to be like this-

string url=”https://www.msn.com/en-us”;

A url contains the protocol followed by two forward slashes and the domain name. If you compare the code the URL with the code above, what do you notice?

You should notice that the URL contains “two forward slashes” which is actually the syntax for commenting out code in C# !! Clearly a conflict of Interest!

Which essentially means that if a compiler comes across the declaration of the string URL, it would only read until here

string url=”https:

And it will Ignore the rest of the line, since the compiler thinks that the code is commented out.

How can this be fixed? How can we tell the compiler that the forward slashes in the URL do not Intend to be a comment but it is actually a part of the String?

All we have to do is to add a Back Slash in the front of each forward slash so that the compiler knows that it is not a comment.

This is how it should be-

string url=”https:/\/\www.msn.com/en-us”;

Outlook Keyword Search

Outlook is a mail client from Microsoft. As any other mail client it helps you Integrate all your mail accounts to one place so that you can access your emails without having to move around.

There are often times when you need to search for an email or a set of emails from the past. The obvious way to go about this is to search for some words or keywords that you think might have been in the content of the email. If it is a single word, one could just type that word in the search bar and search for it. But, if your search contains more than one word and you think that the words go together then you definitely need to put them under double quotes. This is done so that Outlook knows that it needs to match the whole set in order to qualify for a successful search result.

Screen Shot 2018-02-02 at 11.57.30 PM.png

If the words are not in double quotes, Outlook might come to a conclusion that the words need not be together and it would search for them separately. For Instance if you are searching for two words and an email contains those two words but in different places, Outlook would list that in the search result.

So, the next time you are searching for something in Outlook and especially if you are trying to search for words that belong together, do not forget to “put them under   quotes” !!

How to get the list of folders that are empty in SharePoint?

SharePoint is a document management and collaboration platform. There may be times and Instances where you would need to check for folders that have no files in them. One approach is to manually open each folder in a document library. This approach might suffice if you have just a handful of folders. But what if you have more than 100 folders? Checking each one of them is definitely going to be time consuming.

SharePoint has something called as views which control and determine how you would like your files or folders to be represented in the Document Library. For Instance you could have a view which shows only files that were modified in the past 15 days. Or you could show files that were created yesterday. The filtering criteria gives one a lot of options to play around with.

As one knows a document has a certain set of properties associated with it. Like Creation Date, Modified Date, Author etc. There is one property that would help in getting us the list of folders that are empty. The property is called Item Child Count. Item Child count displays the number of files in a folder. In order to achieve our goal, we would have to create a view that displays only folders whose Item Child Count=0.

Follow these steps on creating a view and setting the value of Item Child Count.

  1. Go to your Document Library.
  2. Then goto your Library Settings. Screen Shot 2018-02-01 at 8.29.18 PM.png
  3. Scroll Down and Click on Create viewScreen Shot 2018-02-01 at 8.29.38 PM
  4. On the View Type, select Standard View.
  5. Scroll down to the Filter Section
  6. Under “Show the Items when column”, choose the value Item Child Count.
  7. Set the value equal to 0.
  8. Scroll Down and click OK.

 

This would create a view that displays folders which are empty.

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.

 

 

 

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!!