If you're working in a multiple-compiler environment, you may wish to get information at compile time about which compiler you're building with. Here's a list of macros defined by many compilers:
https://sourceforge.net/p/predef/wiki/Compilers/
Ramblings of a software developer with a degree in bioinformatics. Agile development mixed with DNA sequencing - what could go wrong?
Thursday, February 27, 2020
Friday, February 14, 2020
Enabling wind power nationwide
A report from the Obama Department of Energy in 2015.
https://www.energy.gov/sites/prod/files/2015/05/f22/Enabling%20Wind%20Power%20Nationwide_18MAY2015_FINAL.pdf
https://www.energy.gov/sites/prod/files/2015/05/f22/Enabling%20Wind%20Power%20Nationwide_18MAY2015_FINAL.pdf
Thursday, February 13, 2020
Take a newick tree and stre-e-etch the leaves to make it ultrametric
I needed to generate some ultrametric Newick trees for some simulations. There's a nice Newick tree generator online at http:/Trex/trex.uqam.ca/index.php?action=randomtreegenerator&project=trex, but it doesn't have any way to make an ultrametric tree. (Ultrametric means that the lengths from root to tip are all of the same.) So I put together a short script using BioPython to replace the length of each leaf node to make the lengths all identical to the longest length.
How to delete empty rows in an Excel spreadsheet
How to delete empty rows in an Excel spreadsheet:
https://www.itsupportguides.com/knowledge-base/office-2016/excel-2016-how-to-delete-empty-rows/
https://www.itsupportguides.com/knowledge-base/office-2016/excel-2016-how-to-delete-empty-rows/
Monday, August 10, 2015
How Installing a Random Tool Caused Ruby on Rails to Stop Working
At work I maintain a little Ruby on Rails site. Not a particularly interesting site, just a set of pages of statistics gathered from various databases around the organization. It runs on a RHEL6 virtual machine and I write most of the code on my Windows laptop using RubyMine from JetBrains - a product I wholeheartedly endorse, by the way.
It does take a little patience to run Rails on Windows - not due to any deficit in either product, just because the vast majority of people who work with Rails are running it on some other platform, so when you have problems, a lot of times you're on your own.
Take this problem I ran into recently, for example. I launched RubyMine to check out a bug, fired up the ol' testing server, browsed to the web page, and was greeted with this:
JSON::ParserError in Statistics#index
Showing /app/views/layouts/application.html.erb where line #5 raised:
757: unexpected token at 'Node Commands
Syntax:
node {operator} [options] [arguments]
Parameters:
/? or /help - Display this help message.
list - List nodes or node history or the cluster
listcores - List cores on the cluster
view - View properties of a node
online - Set nodes or node to online state
offline - Set one or more nodes to the offline state
For more information about HPC command-line tools,
see http://go.microsoft.com/fwlink/?LinkId=120724.
(in /app/assets/javascripts/accounts.js.coffee)
Now, of all possible error messages to get, one involving HPC command-line tools was not one that I had ever considered. What's going on here?
The line that gives the error is one that occurs in every Rails application:
It does take a little patience to run Rails on Windows - not due to any deficit in either product, just because the vast majority of people who work with Rails are running it on some other platform, so when you have problems, a lot of times you're on your own.
Take this problem I ran into recently, for example. I launched RubyMine to check out a bug, fired up the ol' testing server, browsed to the web page, and was greeted with this:
JSON::ParserError in Statistics#index
Showing /app/views/layouts/application.html.erb where line #5 raised:
757: unexpected token at 'Node Commands
Syntax:
node {operator} [options] [arguments]
Parameters:
/? or /help - Display this help message.
list - List nodes or node history or the cluster
listcores - List cores on the cluster
view - View properties of a node
online - Set nodes or node to online state
offline - Set one or more nodes to the offline state
For more information about HPC command-line tools,
see http://go.microsoft.com/fwlink/?LinkId=120724.
(in /app/assets/javascripts/accounts.js.coffee)
Now, of all possible error messages to get, one involving HPC command-line tools was not one that I had ever considered. What's going on here?
The line that gives the error is one that occurs in every Rails application:
<%= javascript_include_tag 'application' %>
What it really comes down to saying is, take all of the Javascript and Coffeescript code in the application, and include it here. A little wasteful, perhaps, but in a production environment all of the code will get glommed into a single file appropriate for caching in the browser, so it's not a bad system. Still, where's the error?
Obviously it must be in the Coffeescript file referenced at the end of the error message. But why is it suddenly complaining about HPC? I went and commented that whole file out - no joy. The same error got reported with a different file. I could find no information anywhere about what the cause might have been, and I didn't expect searching for the error message itself would do any good. I work in an HPC - which stands for High Performance Computing, incidentally - environment so I was fairly sure the error was something very specific to my machine.
I tried, of course. Several different Google searches failed - but I finally hit on the right combination of keywords that led me to a Google Plus comment on a YouTube tutorial.
It turns out that Rails, in its infinite struggle for flexibility, relies on a gem called ExecJS to decide how it's going to convert Coffeescript to Javascript. ExecJS, in turn, is of the opinion that Node.js is a really good way to do the conversion. And it determines if Node.js is available by trying to run an application called Node.
Which is fine, unless you happen to run Windows; and you happen to work in an HPC environment; and you happen to have gone to a conference the other week where you decided to install Microsoft's HPC tools; which happen to include a nice command for managing compute nodes; called - you guessed it - Node. ExecJS was trying to use Microsoft's Node command to convert Coffeescript to Javascript, resulting in the error you see. Hats off to Jonathan McDonald for nailing the issue.
Subscribe to:
Posts (Atom)