Concatenating cells in Excel

To concatenate cells in Excel, you can either use the concatenation() function or the & symbol. If

A1 = Hello
A2 = World



will produce



=concatenate(A1," ",A2)

will produce

Hello World

If the concatenation is not working, then make sure that the format of A1 and A2 is "text" and the format of the cell with the concatenation function/formula is "general".

tar: 0511-194 Reached end-of-file before expected

This error is caused if the size of your file is larger than the allowed filesize. Suppose the system has a limit of 1 Gb. If you tar and zip twenty 100 Mb files, then the size of the tarred file would be approximately 2 Gb. So the system would give you this error:

tar: 0511-194 Reached end-of-file before expected

To solve this problem, you would need to increase your filesize or remove the limitation as follows:

$ vi /etc/security/limits

Change fsize = -1 and save file

Java file I/O

Java provides a number of classes and methods that allow to read and write files. In Java all files are byte-oriented. Two of the most often-used stream classes are FileInputStream and FileOutputStream, which create byte streams linked to files.

  1. To open a file, simple create an object of one of the classes specifying the name of the file as an argument to the constructor.
  2. Use close() to close the file


Setting script src dynamically

Suppose you need to call some JavaScript code on your page such as:

  <script src"somecode.js"></script>

However, the somecode.js is different based on other parameters on your page. So you would need to pass a variable rather than the static string to the src. If you just replace somecode.js, with a variable name, you code will not be called.

The following example shows how you can manipulate DOM to define src so that your code runs.

Print screen on Mac

The Mac OS keyboard does not have a print screen button. So this is how to capture your screen on Mac:

  • Hold down Apple key ? + Shift + 3 and release all

The screen shot would appear on your desktop.

You can also do a screen capture for a portion of your screen.

  • Hold down Apple key ? + Shift + 4 and release all key
  • Mouse cursor would change to +
  • Select the region you wish to capture


Quick way to find which log file is logging errors

On development systems it is common practice to have different log file to log PHP error logs for different tools and different versions of the same tool. Generally it is a good idea to use meaningful names to make it easy to distinguish between the log files. If you have doubts, you can either look inside the code to see which error log file is being called or do the following:

$ cd ~
$ ls -al /var/log/httpd before.diff

Run the tool such that it would write something to the log file. Then

Setting up multiple displays on Mac OS

It is now common for users to work with multiple monitors. Laptop users, especially, prefer to work on their laptop screen and an external monitor when at they at work or at home. If you are using netflix or some other service to download movies, you would prefer to watch it on large screen rather than your laptop screen, so you would want to connect your computer to a TV or projector.

It is very easy to connect Mac OS computers to external monitors.

Some quick APT commands

Advanced Packaging Tool (APT) is used by Debian system to manage package installations. Following are some quick commands:

Some common commands that can be used with APT:

Installing packages

$ sudo apt-get install package

Removing packages

$ sudo apt-get remove package

Getting a list of packages

$ sudo apt-get update

Upgrading packages

$ sudo apt-get upgrade