Category Archives: Computer Science

About computers, algorithms and unusual troubleshoots.

Installing Fortran Compiler for Visual Studio 2017

Fortran has come a long way than we had studied in high-school in 19xx. Its now fully supported within Microsoft visual studio. To install Fortran with VS IDE support, ensure the followings:

Modify/Install the installation file of VS 2017 Community edition (its free!) and install support for Desktop development with C++ .  This step will ensure that the Fortran compiler is available from within the VS2017. (Ref:

  1. During installation/modification under the Workloads view (shown below), select the checkbox to install the Desktop development with C++ component.
  2. To build applications to run on Windows XP*, check the Windows XP support for C++ component in Summary window
  3. Continue with the installation

Download Fortran compiler- Intel® Parallel Studio XE (its free too!) from You need to register with academic email address. Install it after downloading.

For offline installation you can download licence file from your profile page after logging in. (Ref:


  • Click on any active serial number to go to the corresponding Manage License page.
  • There are two icons on the License File header ‘Download license file’ and ‘Resend license file to my email’.





Catchment area calculation in QGIS

The method is similar to any other GIS method. The steps are as follows; the main step is highlighted in bold fonts. It is up to you to beautify the map.

  1. Get the DEM files (for eg. from
  2. Clip it if necessary. This can reduce the computation time.
  3. Reproject the lat/long DEM file to metric base e.g. UTM (this is essential for any area based analysis).
    Raster>Projection> Wrap
  4. Make sure the projection coordinate used in DEM and your data frame matches.
  5. Fill the projected DEM for any inconsistent data.
    Processing toolbox>SAGA>Terrain analysis(hydrology)>Fill sinks (wang & liu)
  6. Calculate Strahaler order for the filled raster. This is necessary to know the river lines. The intake location should lie exactly on the river line shown by Strahaler .
    Processing toolbox>SAGA>Terrain analysis(channels)>Strahaler order
  7. Delineate the catchment using upslope command. Choose the X,Y coordinate lying on the line calculated by Strahaler .
    Processing toolbox>SAGA>Terraine analysis>Terrain analysis(hydrology)>Upslope area
  8. Using Raster to vector convert the delineated raster to vector.
    Raster>Conversion>Raster to vector
  9. Go to attribute table, add new field with formula “area”. The area is calculated in square meters.


Changing company name in

To change the name of company for which is licensed, use following steps:

  • Open registry by running Regedit
  • Scroll down through the displayed lists and expand STAADPro
  • Select 2007 (20.07.10 for STAAD.Pro SS5 or 20.07.11 for STAAD.Pro SS6)
  • Double Click on Username
  • Enter your desired Company name as shown in attached screen capture.

Word cound in MS-Word using Fields

Sometimes you want to count the number of words in MS word file excluding titles, references etc. To do this follow these steps:
First count the number of words that has to be ignored (by selecting them, the status bar at bottom shows the number of selected words e.g. 15/1542)
Insert field using Ctrl+F9. a double bracket {} should appear.
type =
then insert field codes from insert menu (like number of pages, words etc:: insert>quickpart>fields>NumWords)
it should look like {=130-12}
right click and toggle the field code.

Now if you change the document, update the field code by selecting it and pressing F9 button.

Autocad calculation using fields and blocks

While drafting in AutoCAD, sometimes we come to situation where we need to upadate some text based on values of other text (similar to using formulas as in excel). In such case we can use FIELDS of Autocad to do our calculations and update the drawings automatically.


The basic method to use field is very easy. Try following steps to get the idea.

>>MTEXT (type some number say 151) and click ok

>>MTEXT>Instert Field (or directly use FIELD command) : a dialog box will appear as shown below


-Select Field category: Objects

-Field names: Formula

-In Formula filed: right click >insert field : this will open new field window (the idea is use field value within another field)

-In this new Filed dialog box choose

-Filed names: Objects

-Objet type:Select the Mtext with the input number


-Click Ok


Now in the original window there will be some value like 151 at the end type *2 so the content will look like 151*2

-Click ok

The new Mtext will change to value showing 302.

-To edit the formula, double click the field.

Now if the first Mtext value is changed to 100 from 151 then after REGENERATEing the drawing. The field will show 200.

For blocks

The fields will work not only in Mtext but also in Block attributes, hence making life easy to create blocks which has multiple values based on some formula of few input parameters. For eg a scale block (as shown below). However, there are few differences. A sample method is given below using example of scale block:


– Draw the shapes (lines, hatch etc)

-Define block attributes (name them L1, R1,R2,R3,R4,R5,SCALE) (i made SCALE as hidden so that it will not be visible and will be used for calculation only) also i made all tags prompting to “DO NOT EDIT” as you will see later as these values should be updated automatically).

-Create block using BLOCK command

Now double click the box to change attibute value (say for value of L1).

-in Value field >right click>edit field

Now the field dialog box appears as discussed above.

-Select formula in field name

-in formula right click >Add fileds

New field dialog box appears

-select Object in field names

-select the Block that you had just created in Object type

-all tags will appear in the property (L1, R1,R2,R3,R4,R5,SCALE)

-Chose the tag that you want to use (here SCALE). Click ok

Back in the formula write the required formula using this variable (eg 1000*50)

-Click ok

Close all the dialog box

Now if you change value of SCALE tag and regenerate, the value of L1 will change according to the formula specified.

Repeat the process for all the tags to get required value.