NameError from Python input() function

input reads and evaluates a Python expression. When it tries to evaluate it, it looks for a variable e, which is not defined, and fails. You almost always want to use raw_input instead. (And in Python3, input has this behaviour.) Or, better, on Unix, use readline so the user can edit their input.

undefined reference to `std::ios_base::Init::Init()’

You can resolve this in several ways: Use g++ in stead of gcc: g++ -g -o MatSim MatSim.cpp Add -lstdc++: gcc -g -o MatSim MatSim.cpp -lstdc++ Replace <string.h> by <string> This is a linker problem, not a compiler issue. The same problem is covered in the question iostream linker error – it explains what is … Read more

What is char ** in C? [duplicate]

Possible Duplicate:What is double star? I am fairly new to C, and have come across this statement I have a pretty good idea of what typedef does, but I have never seen char** before. I know that char* is a char array or similiar to a string. Im not sure if char** is a 2d … Read more

Categories C Tags

What is the best way to convert an array to a hash in Ruby

NOTE: For a concise and efficient solution, please see Marc-André Lafortune’s answer below. This answer was originally offered as an alternative to approaches using flatten, which were the most highly upvoted at the time of writing. I should have clarified that I didn’t intend to present this example as a best practice or an efficient … Read more