Pages

Sunday, December 22, 2013

Design Patterns & Fortran

The advent of Object Oriented Programming (OOP) has brought with it the positives of inheritance, composition, aggregation and reusability. Modern languages like C++, Java and C# have built upon these principles and have made their mark in the community. With the adaptation of OOP, the community has agreed upon some best practices which are classified as Design Patterns.

Fortran 2003 has introduced the constructs which have brought some of the best features of OOP in the language. However, the large code base used by the scientific community is still clustered with Structured Programming. The code is cluttered with variables and methods which make it hard to read and maintain.

FortranPatterns is an open source project aimed at implementing the established Design Patterns using the Fortran 2003 constructs with the aim of introducing to the scientific community the best practices.

GitHub - FortranPatterns
Fork

Factory Design Pattern Implemention Using Fortran

Fortran 2003 opened a new dimension of Object Oriented Programming (OOP) in the world of Fortran. Used widely by scientific community, the usage of Fortran is still limited to the Structured Programming approach. The resulting code is long list of jumbled up uncommented methods and variables which make it very difficult to read. Adapting OOP best practices can change this.

OOP provides better encapsulation, abstraction, composition and reusability for the code. Design Patterns go one step further. These are best practices adapted by the community for solving certain kind of problems. Depending on the task, these patterns can be behavioural, structural or creational. Factory pattern is classified as creational pattern.



Factory pattern provides one of the best ways to create objects which comply with the same interface. In this pattern, the creational logic is not exposed to the client. Rather a singular interface is provided and the client gets the object using this interface by specifying the kind of object it is demanding.

Following is an implementation of Factory pattern in Fortran.

https://github.com/FactoryPattern
Fork

Reuse & enjoy!

Tuesday, December 17, 2013

Google Drive's Delete Confirmation Dialog

So the real annoyance I am facing is the Google Drive's delete confirmation dialog that keeps on popping up.


So to make it disappear, try the following if you are on Mac:

Remove the item from the login items:



Then go to terminal and type the following to start the application:


/Applications/Google\ Drive.app/Contents/MacOS/Google\ Drive --noshow_confirmation_dialog_on_delete

Viola!

On Windoes go to terminal (cmd.exe) and type the following and press Enter:

C:\Program Files (x86)\Google\Drive\googledrivesync.exe" --noshow_confirmation_dialog_on_delete

Sunday, December 15, 2013

Generate an Android project using the amazing Maven Archetypes

So I can't seem to get over the convenience of using Maven Archetype for generating Android project. Does all the work for ya!

mvn archetype:generate \
  -DarchetypeArtifactId=android-quickstart \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.10 \
  -DgroupId=your.company \
  -DartifactId=my-android-application

For more details and a thorough introduction to the concept of Archetypes:
http://maven.apache.org/guides/introduction/introduction-to-archetypes.html


P.S. Remember, android-maven-plugin version 3.6.0 is your friend! So edit the pom.xml generated and change the version to 3.6.0 (or higher).

Use homebrew to install maven 3.0.5 on OS X

Quite frankly, I have found working with maven 3.1.1 a pain in the a**. This is because of various compatibility issues with preexisting projects. So here is a simple way to install maven 3.0.5:

brew install maven30

For those of you who will still go with 3.1.1:

brew install maven

Enjoy!

Sunday, December 8, 2013

Trace Metals in Atmosphere

Trace metals enter the atmosphere through different anthropogenic and natural sources. Some of the emission sources are gasoline, combustion, non-ferrous metal production. Once in the atmosphere, the trace metals do not remain confined to the local region but are carried to other regions and impact on a global level. The enrichment of trace metals has been noted as far as Arctic. This has impacted ecology, economy and quality of life. E.g. the increase in levels of Cd (Cadmium) and Pb (Lead) are known to cause spontaneous abortion in women in the first 3 months of pregnancy.

A global emission inventory can help in modelling the role of trace metals in riverine and atmospheric ecosystem. The changing emission factors, e.g. the use of low leaded gasoline, are indicative of the need for revision of such inventories on a regular bases. Lack of data makes it hard to come up with accurate emission inventories and hence a lot of assumptions are made which introduce uncertainty. Although every industry discharges at least one trace metal to the environment, yet this data is not recorded and hence, a lot of averages need to be estimated in order to create an inventory for use with simulations.

For industrial input, the first study which quantifies the emission of 16 different trace metals in air, soil and water on a global scale was conducted in 1980s and published in 1988. There have been just a few updates to this data and those were done in 1995 and 1996 for the data collected at the beginning of 1990s. There have been several studies done on a local scale on a limited set of trace metals.

Ref: "An assessment of global and regional emissions of trace metals to the atmosphere from anthropogenic sources worldwide" by Pacyna & Pacyna.

Sunday, August 25, 2013

Questions to Ask Before Accepting New Job Offer

1. What is the designation?
2. What is the salary?
3. What are the benefits?
4. When will the benefits start?
5. What is the probation period?
6. What is the nature of work?
7. Do you accommodate work from home?
8. How many yearly paid vacation days are there?
9. What are the regular working hours?

Any suggestions are welcome.