Skip to content
frogwarrior edited this page Aug 27, 2014 · 7 revisions

Using Composer To Your Benefit

I noticed a file that was incuded in the source code was missing from the package I cloned from the git repository. Solving this is very simple, running composer.phar on the default composer.json file will add the vendor directory and the autoload.php file. Its very easy to customise this default json.composer file to use it to manage extra javascript, css, PHP etc. packages. The default json.composer file only includes PHP5, but you can add any additional packages and repositories to the file, for example, heres what my require key now looks like:

I've given up trying to make the markdown code look right, I can't get it to add the indentations so it looks horrific so for now I'll have to settle for pastebin: http://pastebin.com/3QyNH6f7

One issue is that composer installs these packages to the vendor directory by default. The autoloader may need editing for that.

NOTE: I'm new to GIT, how can I make the code wrapper include the indentation? This json code looks monstrous without proper indentation and formatting.

IDIORM For Scientists

Sorry if this is not the place to discuss this, this isn't a guide or tutorial, just a brainstorm on how to make idiorm more useful for chemists. I was previously using XCrud and found it too restricted in the way it forces you to output the database results in specific ways, but it had some good features like callback functions that could be applied to any field. I've literally only been using idiorm for a couple of days so I don't know whats what, but if you want to display molecular formulas (i.e. H2SO4) without having to manually enter the subscripts, heres a simple callback function for your molecular formula field:

function molecularFormula($value, $fieldname, $primary_key, $row, $xcrud) { return preg_replace('/([A-Z)])([0-9]+)/', '\1\2', $value); }

To display ions and chemical equations, you need more complex functions and in my opinion its best to use MathJAX for that. There is a plugin for MathJAX called mhchem which is the ultimate chemistry parser. I'm an open source man myself and appreciate free software so I'll make a plugin geared towards scientists in the future if thats possible.

Clone this wiki locally