15 Feb

Parsing SMILES using Razi

Razi is a new scientific library for java. By now this library is ready to parse SMILES and make an object-oriented model of a molecule.

  1. Download The library, and import it into your project.
  2. Make an instance of com.razi.formats.smiles.Reader.
  3. Call the set method and set the input string.
  4. Call the process method.
  5. Done !

The code of above is :

Reader sr = new Reader();
sr.set("C(=O)O");
sr.process();

Molecule mol = sr.get();

Now use descriptors to test it. By now com.razi.descriptor.molecular.CountDescriptor is available to get some basic countable informations of a molecule.

cd.countAtoms(); // Number of all atoms
cd.countBonds(); // Number of all bonds
cd.countBondsByOrder(2); // Number of bonds with order 2
cd.countAtomsByElement(element); // Number of all atoms which are the same with given element

If you are interested in cheminformatic and you like to be contributor you should see Razi on Github.

5 Feb

Symfony2 Calendar Bundle

Today I publish one of my symfony2 bundles. CalendarBundle is a Symfony2 bundle which helps you to show Datetimes based on a calendar. CalendarBundle uses a strategy that allows you to make your arbitary driver.

Currently drivers are :

  1. Gregorian
  2. Persian (also known as Hejri Khorshidi, Hijri Shamsi (Persian: هجری شمسی, هجری خورشیدی). It is official calendar in Iran)

Read more and get installation instruction on Github.

25 Jan

gzip contents in web, Advantages and Disadvantages

According to RFC2616 a Http Request may contain an accept-encoding header field :

The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings (section 3.5) that are acceptable in the response.

For example :

Accept-Encoding: compress, gzip

Why does a browser send this information to the webserver ? Simply it says that the browser is able to decode gzip. But what are these all for ?

If the webserver handles this capability it will be useful to compress some files, assets (Javascript, CSS) or even your major text/html response.

Compressing contents has some advantages and disavantages, so we discuss about that to answer this question : When should we gzip our responses and when not ?

Advantages

  1. Compressing contents helps with decreasing the time it will take for client to download.

  2. It saves your bandwidth so it reduces costs ! (Don’t wonder if in your country it doesn’t matter ! In many countries such as mine, monthly bandwidths are too expensive and this is important to save it !)

Disadvantages

  1. Compressing contents eats your server’s CPU cycles !

The conclusion is that there is no disadvantage for your user !

How to enable it in Apache

To compress contents using Apache make sure that mod_deflate is enabled.

LoadModule deflate_module modules/mod_deflate.so

Then add this in httpd.conf :

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json
</IfModule>

But unfortunately it doesn’t cache the static datas and increases the load on your server.

16 Jan

Welcome to my blog!

Welcome to my blog ! This blog is about Web Technologies, Software Developing and Scientific softwares.

Check out my Repositories on github for more info on what we’re going to discuss.

I hope you’ll join me !