Problem:
You want to read alignment matrices like BLOSUM62 in the QUASAR format. The solution needs to be integrable into C++ code easily.
You want to read alignment matrices like BLOSUM62 in the QUASAR format. The solution needs to be integrable into C++ code easily.
It is surprisingly difficult to compute simple statistics of FASTA files using existing software. I recently needed to compute the nucleotide count and relative GC frequency of a single sequence in FASTA format, but unless you install dependency-heavy native software like FASTX or you develop it by yourself using BioPython or similar, there doesn’t seem to be a simple, dependency-free solution for this simple set of problem.
You use Docker, but working with it created lots of images and containers. You want to remove all of them to save disk space.
You have a Java FXML file document with a TableView and want to set the columnResizePolicy of this TableView in the fxml document.
You want to use mmap()
from sys/stat.h
POSIX header to map a file for reading (not writing). You can’t find any simple bare example on the internet.
You want to use stat()
from sys/stat.h
POSIX header in order to get the size of a file.
You want to use stat()
from sys/stat.h
POSIX header to check if a file with a given name exists.
You want to create a binary DEB package of the msgpack C++ binding. However, there is no official DEB package available.
Problem:
On your Linux system, you want to check whether transparent hugepages are enabled on your system.
Solution:
It’s pretty simple:
cat /sys/kernel/mm/transparent_hugepage/enabled
You will get an output like this:
always [madvise] never
You’ll see a list of all possible options ( always
, madvise
, never
), with the currently active option being enclosed in brackets.madvise is the default.
You want to create a binary DEB package of libsodium. However, there is no official DEB package available for the latest version.
This is not the first tutorial on UML — there are hundreds of them publicly available on the internet. However, none of them seems to fulfill my requirements:
You want to use the mkdir()
function from the sys/stat.h
POSIX header, but you don’t know what the mode_t
argument should look like.
You intend to install LevelDB, but you don’t want to manually install & compile it as described here.
Instead, you just want to use the debian packaging system and some reproducible method of creating a DEB package from LevelDB.
Reasons for preferring not to compile & install manually could be:
The following C++ program uses boost::iostreams
to memory-map a file, read it’s content into a std::string
and print it to cout
.
It provides a minimal example of how to use the boost::iostreams
portable mmap
functionality.
//Compile like this: g++ -o mmap mmap.cpp -lboost_iostreams #include <boost/iostreams/device/mapped_file.hpp> #include <iostream> #include <string> using namespace std; using namespace boost::iostreams; int main(int argc, char** argv) { //Initialize the memory-mapped file mapped_file_source file(argv[1]); //Read the entire file into a string string fileContent(file.data(), file.size()); //Print the string cout << fileContent; //Cleanup file.close(); }
Also see A simple mmap() readonly example
This article describes a method of reading TAR archives (including .tar.gz and .tar.bz2) in C++ using Boost IOStreams.
You could use libtar for this, but the original version hasn’t been updated since 2003 and doesn’t provide you flexibility and insight to the internal structure of a TAR archive. Continue reading →
You can list all codecs supported by libavconv
(the library used by ffmpeg
/ avconv
) by using this command:
ffmpeg -codecs
If you don’t have the ffmpeg
executable simply use
avconv -codecs
Note that avconv and ffmpeg are essentially the same, but the projects split at some time and then re-merged. Starting from Ubuntu 15.04, ffmpeg is available in the repositories again, whereas previously, ffmpeg was replaced by avconv.
For details, see this StackOverflow thread and this detailed post about the ffmpeg/libav situation.
Using the libcurl easy API you want to download a file using HTTP GET. No extended features such as authentication shall be used.
The download result shall be stored in a std::string
Why trying to access your Android device using ADB, you encounter the following error:
error: insufficient permissions for device
You’re trying to compile something (e.g. using GCC) on Ubuntu, but you get an error message similar to this one:
/usr/bin/ld: error: cannot open crt1.o: No such file or directory /usr/bin/ld: error: cannot open crti.o: No such file or directory /usr/bin/ld: error: cannot open crtn.o: No such file or directory
You want to use the LLVM Gold linker plugin but LLVMgold.so can’t be found.