LaTeX: Multiple authors in a two-column article

I put together a little test here: Things to note, the title, author and date fields are declared before \begin{document}. Also, the multicol package is likely unnecessary in this case since you have declared twocolumn in the document class. This example puts all four authors on the same line, but if your authors have longer names, departments or … Read more

Invalid pointer error on invoking free() after malloc in C

I am doing very basic dynamic allocation practice in C and I came across this issue: when I am trying to call free() with the pointer returned by malloc(), I am getting Invalid pointer error during run time. When I remove free() from code, it works fine. The pointer that I am using is not modified anyhow after returned by malloc (except … Read more

How to open some ports on Ubuntu?

I know little about Linux.Today I create a VPN server on My ubuntu according to https://github.com/philplckthun/setup-simple-ipsec-l2tp-vpn But when I finish the installation. I use my iphone to connect the ipsect vpn,bur it shows the VPN Server has no response. The github document shows Ports 1701, 500 and 4500 must be opened for the VPN to work! So … Read more

How do you call an instance of a class in Python?

You call an instance of a class as in the following: But this will typically give us an error. How can we call the instance as intended, and perhaps get something useful out of it? We have to implement Python special method, __call__! Instantiate the class: Now we can call the class instance: which prints: And … Read more

Random number c++ in some range

You can use the random functionality included within the additions to the standard library (TR1). Or you can use the same old technique that works in plain C:

Can’t open Jupyter notebook with Anaconda

It seems to be a problem with the default installation of Anaconda. So, I removed the pyzmq package, which seems to be the problematic one. This is what I have done: conda uninstall pyzmq (This also removes jupyter related packages!) conda install pyzmq (to reinstall it) conda install jupyter (to reinstall jupyter related packages) Now I can open Jupyter Notebook!

SyntaxError: Unexpected token o in JSON at position 1

The JSON you posted looks fine, however in your code, it is most likely not a JSON string anymore, but already a JavaScript object. This means, no more parsing is necessary. You can test this yourself, e.g. in Chrome’s console: JSON.parse() converts the input into a string. The toString() method of JavaScript objects by default returns [object Object], resulting … Read more

Custom legend for multiple layer ggplot

Instead of setting colour and fill, map them using the geometry aesthetics aes and then use scale_xxx_manual or scale_xxx_identity. Eg Note that you must specify guide = ‘legend’ to force scale_…_identity to produce a legend. scale_…manual you can pass a named vector for the values — the names should be what you called the colours within the calls to geom_… and then you can label nicely.

Categories R