Say you need to generate a sequence, in C++, simply consisting of the first so many integers, like, 1,2,3,4,5.
With a little programming experience, you can come up with a dozen different ways to do this, but here's an obscure one:
std::list<int> l(5);
std::iota(l.begin(), l.end(), 1);
According to CppReference, the function is named after the integer function ⍳ from the programming language APL.
The more you know.
Ramblings of a software developer with a degree in bioinformatics. Agile development mixed with DNA sequencing - what could go wrong?
Wednesday, April 29, 2020
Saturday, April 11, 2020
Command Line tips from CLI Magic
Tips for working with the command line from CLI magic. I like this one to show all listening TCP/UDP ports for the current user:
$ lsof -Pan -i tcp -i udp
https://www.patreon.com/posts/climagic-003-5-35703693
$ lsof -Pan -i tcp -i udp
https://www.patreon.com/posts/climagic-003-5-35703693
Wednesday, April 01, 2020
Covid-19 infections by county, over time
This is a visualization choropleth I put together of Covid-19 infections for each county over time. It's based on the NY Times data set and I built the images in Python based off a very good, if ancient, tutorial I found at FlowingData.
Edit: Updated through Apr. 13 data, and also made the original larger. Not sure if that matters for this web page or not.
This image is licensed under the Creative Commons Attribution-NonCommercial 4.0 International license. I would appreciate attribution if you care to use it!
Edit: Updated through Apr. 13 data, and also made the original larger. Not sure if that matters for this web page or not.
This image is licensed under the Creative Commons Attribution-NonCommercial 4.0 International license. I would appreciate attribution if you care to use it!
Tuesday, March 31, 2020
BeautifulSoup4 in Python
A lot of code available that uses BeautifulSoup tells you to call it like so:
from beautifulsoup import BeautifulSoup
If you've installed BeautifulSoup4, though, this won't work. The main module name has been changed to bs4. So change the code that does that to
from bs4 import BeautifulSoup
Please make a note of it.
Thursday, February 27, 2020
Pre-defined compiler macros
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/
https://sourceforge.net/p/predef/wiki/Compilers/
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
Subscribe to:
Posts (Atom)
