What does “Fatal error: Unexpectedly found nil while unwrapping an Optional value” mean?

Background: What’s an Optional? In Swift, Optional<Wrapped> is an option type: it can contain any value from the original (“Wrapped”) type, or no value at all (the special value nil). An optional value must be unwrapped before it can be used. Optional is a generic type, which means that Optional<Int> and Optional<String> are distinct types — the type inside <> is called the Wrapped type. Under the hood, … Read more

Error: No viable overloaded =

Your code should be You are allocating an object on heap using new operator which returns pointer to the object created and you are trying to assign a pointer to an object. Better alternative here would be allocate object on stack which you are doing it already. MemberListEntry mEntry(id, port); This creates and initializes the … Read more

When does a process get SIGABRT (signal 6)?

abort() sends the calling process the SIGABRT signal, this is how abort() basically works. abort() is usually called by library functions which detect an internal error or some seriously broken constraint. For example malloc() will call abort() if its internal structures are damaged by a heap overflow.

No module named serial

and I got a question when I run my Python code. I installed Python 2.7 on Windows 7, bit 64. I got an error “No module named serial” when I compiled my code: I tried many ways to crack this problem, such as installed Canopy to setup virtual environment, make sure ‘pip’ is there, no … Read more

Display exact matches only with grep

ou need a more specific expression. Try grep ” OK$” or grep “[0-9]* OK”. You want to choose a pattern that matches what you want, but won’t match what you don’t want. That pattern will depend upon what your whole file contents might look like. You can also do: grep -w “OK” which will only match a whole word “OK”, … Read more

How to convert an instance of std::string to lower case

Adapted from Not So Frequently Asked Questions: You’re really not going to get away without iterating through each character. There’s no way to know whether the character is lowercase or uppercase otherwise. If you really hate tolower(), here’s a specialized ASCII-only alternative that I don’t recommend you use: Be aware that tolower() can only do a per-single-byte-character substitution, which … Read more