Using “super” in C++

Bjarne Stroustrup mentions in Design and Evolution of C++ that super as a keyword was considered by the ISO C++ Standards committee the first time C++ was standardized. Dag Bruck proposed this extension, calling the base class “inherited.” The proposal mentioned the multiple inheritance issue, and would have flagged ambiguous uses. Even Stroustrup was convinced. After discussion, Dag Bruck … Read more

Center Plot title in ggplot2

From the release news of ggplot 2.2.0: “The main plot title is now left-aligned to better work better with a subtitle”. See also the plot.title argument in ?theme: “left-aligned by default”. As pointed out by @J_F, you may add theme(plot.title = element_text(hjust = 0.5)) to center the title.

fix java.net.SocketTimeoutException: Read timed out

Here are few pointers/suggestions for investigation I see that every time you vote, you call vote method which creates a fresh HTTP connection. This might be a problem. I would suggest to use a single HttpClient instance to post to the server. This way it wont create too many connections from the client side. At the end of everything, HttpClient needs to be … Read more

How to do vlookup and fill down (like in Excel) in R?

If I understand your question correctly, here are four methods to do the equivalent of Excel’s VLOOKUP and fill down using R: Here are four methods to fill the HouseTypeNo in the largetable using the values in the lookup table: First with merge in base: A second method with named vectors in base: Third, using the plyr package: Fourth, using the sqldf package If it’s possible that some house types … Read more

In Typescript, what is the ! (exclamation mark / bang) operator when dereferencing a member?

That’s the non-null assertion operator. It is a way to tell the compiler “this expression cannot be null or undefined here, so don’t complain about the possibility of it being null or undefined.” Sometimes the type checker is unable to make that determination itself. It is explained here: A new ! post-fix expression operator may be used to assert that its operand is non-null and … Read more

How do I split a string on a delimiter in Bash?

You can set the internal field separator (IFS) variable, and then let it parse into an array. When this happens in a command, then the assignment to IFS only takes place to that single command’s environment (to read ). It then parses the input according to the IFS variable value into an array, which we can then iterate over. This example will parse … Read more

“package XXX is not in GOROOT” when building a Go project

A pretty dumb conclusion (mostly on my part) but my issue came from having done go mod init in each of the folders. after removing go.mod and go.dep from each of the folders I did go mod init in, I could build without issue (through terminal) Also, my packages in GoLand were not being detected because I had Go Modules enabled in the … Read more

Generate pdf from HTML in div using Javascript

jsPDF is able to use plugins. In order to enable it to print HTML, you have to include certain plugins and therefore have to do the following: Go to https://github.com/MrRio/jsPDF and download the latest Version. Include the following Scripts in your project: jspdf.js jspdf.plugin.from_html.js jspdf.plugin.split_text_to_size.js jspdf.plugin.standard_fonts_metrics.js If you want to ignore certain elements, you have to mark them … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)