ASC File Format for 3D Points

There are many complicated file formats for reading and writing 3D mesh data. However, if you work only with 3D points in your 3D geometry application, then the ASC file format is a convenient way to read, write and display point data. ASC stands for ASCII and the files have an extension of .asc. This is a text file format, where each line has the XYZ coordinates of one point, each coordinate separated by whitespace.

For example, the 4 points of a tetrahedron in the ASC format:

-0.0378297 0.12794 0.00447467
-0.0447794 0.128887 0.00190497
-0.0680095 0.151244 0.0371953
-0.00228741 0.13015 0.0232201

Point data stored as ASC files can be viewed using programs such as MeshLab.

About these ads

Excel: Remove Columns in Delimiter-Separated Values File

A Delimiter-Separated Values (DSV) file is a text file with data in several rows, where the data elements in each row are delimited (or separated from each other) and the number of such elements in every row is the same. The most common example of such a file is a Comma Separated Values (CSV) file where the comma character is used as the delimiter. Other common delimiters are space, tab or any whitespace.

If you have access to Linux tools such as cut or awk, removing certain columns from a DSV file is easy! However, if you are using a computer with no such software, worry not since Microsoft Excel can deal with delimited text files easily. Here is how to remove columns from a DSV file:

1. Import DSV file into Excel

Open Microsoft Excel and choose to Open the delimited text file. Excel will display a Text Import Wizard, where you choose the file type as Delimited and in the following dialogs choose the kind of delimiter used in the file. The common delimiters are comma, tab or space. The delimited data from the file should now be displayed correctly in Excel, with one cell for each data element.

2. Remove the columns of data

To remove a column, right-click on its column name (at the top) and choose Delete.

3. Save the file

Save the file back using the Save As option. Here you will need to pick the delimiter format using which you want to save the file. Options include CSV, Tab delimited and Text.

Tried with: Microsoft Excel 2007

PowerShell: Math Functions

I keep a PowerShell console open at all times. I find it to be an excellent replacement for the Windows Calculator for quick calculations. Arithmetic operators are part of the PowerShell language, so they can be used directly at the prompt. For mathematical operations like square root, logarithm and those from trigonometry, the System.Math class from the .Net Framework can be used.

For example, to find the square root we can call the Sqrt() method from the System.Math class:

[System.Math]::Sqrt( 20 )

An easier way to do the same is:

[math]::sqrt( 20 )

This shorter case-insensitive version works because PowerShell is designed for an easy console experience. So, in PowerShell all the System.* classes can be invoked without the System prefix. Also, PowerShell tries to be as case-insensitive as possible, so most class and method names can be called ignoring the case.

Tried with: PowerShell 2
Reference: PowerShell in Action (2nd Edition) by Bruce Payette

Adobe Acrobat: Extract Pages of PDF


Sometimes you may want to extract certain pages of a PDF file and save those pages as a separate PDF file.


This is easy to do with Adobe Acrobat. Open the PDF file in Acrobat and choose DocumentExtract Pages. In the Extract Pages dialog, choose the pages you wish to extract and press OK. A new instance of Acrobat opens with the pages you specified. Choose FileSave to save these pages as a new PDF File.

Tried with: Adobe Acrobat 8

CUDA on Tesla over Remote Desktop


Typically, CUDA programs cannot be executed over a Remote Desktop session. (For more on this problem, see here.) However, if the CUDA device is a Tesla and if it does not need to be the primary graphics device, then you are in luck! A typical setup for Tesla is to have another Quadro device handle the desktop graphics, while the Tesla device handles the computation. In such setups, CUDA programs can be executed on the Tesla device over Remote Desktop! :-)


To be able to successfully execute CUDA programs on a Tesla device, you need to use a Tesla Compute Cluster (TCC) driver and set the Tesla device to TCC mode.

1. Install TCC Driver

CUDA programs can execute on Tesla devices with the CUDA developer driver you might have downloaded off the CUDA webpage. However, the developer driver is not the same as the device specific driver. (For more on the difference, see here.) To be able to use the TCC mode of the Tesla device, the TCC driver specific to the Tesla device is needed.

To get the Tesla driver, use the NVIDIA Drivers webpage and choose the driver for your Tesla device. This is its TCC driver. Install it.

2. Switch to TCC Mode

By default, the Tesla device will be working in a Windows Display Driver Model (WDDM) mode. This is the mode used by most CUDA devices, since they might need to support desktop graphics. If the Tesla device is in the WDDM mode, then it will not be able to execute CUDA programs over Remote Desktop.

To switch the Tesla device to TCC mode, we can use the NVIDIA System Management Interface (SMI) tool. On Windows, this is provided as an executable file named nvidia-smi.exe. On my system, this was found in the C:\Program Files\NVIDIA Corporation\NVSMI directory. Open a Windows command prompt with elevated (Administrator) privileges and change to this directory. (One way to open an Administrator command prompt is described here.)

To list the available NVIDIA devices use the command:

nvidia-smi -q

To view the details of a specific device use the command:

nvidia-smi -q -i 0

The -i specifies the ID of the device. Device IDs begin from 0 upwards.

Finally, to flip the driver model of a device from WDDM to TCC mode:

nvidia-smi -dm 1 -i 0

The -dm parameter takes two values: 0 for WDDM and 1 for TCC.

Changing the driver model mode of the Tesla requires a restart of the system. After the restart, you should be able to execute CUDA programs remotely on the Tesla computer! :-)

Tried with: Tesla C2050 and Quadro 4000

PowerShell: Command History

The Windows command prompt (cmd.exe) has simple command history. You can press the Up/Down arrow keys to cycle through the previous commands. If you want a visual display of previous commands, you can press F7 and use the Up/Down keys to navigate the list and Enter to execute a command.

PowerShell has powerful command history features. To see the list of all available commands from history:

PS> Get-History

To cycle through previous commands from history, press # followed by Tab key presses. Each press of the Tab key, displays one older command from the history stack.

PS> #[Tab]

To switch to a specific command from the stack displayed by Get-History, press #, the number of that command in the stack and Tab. For example, to get the command numbered 9 in the Get-History stack:

PS> #9[Tab]

PowerShell can also find a previous command if you can provide the starting few letters. For example, this will bring up all the commands where I invoked vim:

PS> #vim[Tab]

PowerShell can also understand the * wildcard. For example, this will bring up all the commands where I edited a log file using vim:

PS> #vim log*.txt[Tab]
PS> #vim log*[Tab]

The module that will hook you to command history is PowerTab. Install it (for instructions see here) and press # and Tab to get a visual list of all commands in the history stack! :-) Note that PowerTab does not provide a few of the above features like the wildcards for example.

Tried with: PowerShell 2 and PowerTab 0.99.6

PowerShell: Error on Modifying Shortcut Properties


PowerShell appears in a console with a blue background by default. If you try to change any of the console properties like fonts, colors or size and try to save it, it throws the following error:

Error Updating Shortcut
Unable to modify the shortcut:
Check to make sure it has not been deleted or renamed.


The shortcut has neither been deleted or renamed since we opened the PowerShell console, so this error message is useless. To be able to modify the PowerShell console properties, make a copy of its shortcut and place it anywhere in the Start menu folder. You might want to rename it to My-PowerShell or something different. Open PowerShell using this new shortcut and you will be able to modify and save its properties.

Tried with: PowerShell 2 and Windows 7