How to UPSERT (MERGE, INSERT … ON DUPLICATE UPDATE) in PostgreSQL?

9.5 and newer: PostgreSQL 9.5 and newer support INSERT … ON CONFLICT (key) DO UPDATE (and ON CONFLICT (key) DO NOTHING), i.e. upsert. Comparison with ON DUPLICATE KEY UPDATE. Quick explanation. For usage see the manual – specifically the conflict_action clause in the syntax diagram, and the explanatory text. Unlike the solutions for 9.4 and older that are given below, this feature works with … Read more

std::string to char*

It won’t automatically convert (thank god). You’ll have to use the method c_str() to get the C string version. Note that it returns a const char *; you aren’t allowed to change the C-style string returned by c_str(). If you want to process it you’ll have to copy it first: Or in modern C++:

Using putty to scp from windows to Linux

You need to tell scp where to send the file. In your command that is not working: You have not mentioned a remote server. scp uses : to delimit the host and path, so it thinks you have asked it to download a file at the path \Users\Admin\Desktop\WMU\5260\A2.c from the host C to your local home directory. The correct upload command, based on your comments, … Read more

Tensorflow: why ‘pip uninstall tensorflow’ cannot find tensorflow

It could be because you didn’t install Tensorflow using pip, but using python setup.py develop instead as your link shows. pip uninstall is likely to fail if the package is installed using python setup.py install as they do not leave behind metadata to determine what files were installed. Therefore, you should be able to unistall Tensorflow with the option -u or –unistall of develop To answer for the second … Read more

npm install not working in windows

After countless hours of debugging and researching, I decided to install in a different machine to see if the problem was with my Node installation. It worked. So for everyone who may come across this, know that the possibility to uninstall node and delete NPM will be there. This is what I did. I believe … Read more

Invalid read of size 8 – Valgrind + C

The problem is that you’re freeing the sym, then trying to access a value from the (now-freed) data: sym->next. You probably want something like this for the inner loop: