Symbol to string issue

String interpolation is an implicit to_s call. So, something like this: result = “hello #{expr}” is more or less equivalent to this: result = “hello ” + expr.to_s As karim79 said, a symbol is not a string but symbols do have to_s methods so your interpolation works; your attempt at using + for concatenation doesn’t … Read more

What does the compile-time error “Undefined symbols for architecture x86_64” mean?

When you compile the file, the compiler invokes the linker which tries to generate an executable. But it cannot because you didn’t provide a function named main which is the function that will be executed when your program is launched. Either you don’t want to run the linker because you want to compile several files … Read more

What is the meaning of + in a regex?

+ can actually have two meanings, depending on context. Like the other answers mentioned, + usually is a repetition operator, and causes the preceding token to repeat one or more times. a+ would be expressed as aa* in formal language theory, and could also be expressed as a{1,} (match a minimum of 1 times and … Read more

Symbol hiding in static libraries built with Xcode

Hiding internal names requires a few simple Xcode build settings, and it is not generally necessary to modify source or change the type of the built product. Eliminate any internal symbols required between modules by performing a single-object prelink. Set the Xcode build setting named “Perform Single-Object Prelink” to Yes (GENERATE_MASTER_OBJECT_FILE=YES). This causes ld to … Read more

In Ruby what does “=>” mean and how does it work? [duplicate]

=> separates the keys from the values in a hashmap literal. It is not overloadable and not specifically connected to symbols. A hashmap literal has the form {key1 => value1, key2 => value2, …}, but when used as the last parameter of a function, you can leave off the curly braces. So when you see … Read more

Cannot find symbol assertEquals

assertEquals is a static method. Since you can’t use static methods without importing them explicitly in a static way, you have to use either: import org.junit.Assert; … Assert.assertEquals(…) or: import static org.junit.Assert.assertEquals; … assertEquals(…) For @Test it’s a little bit different. @Test is an annotation as you can see by the @. Annotations are imported … Read more

How to convert characters to HTML entities using plain JavaScript

With the help of bucabay and the advice to create my own function i created this one which works for me. What do you guys think, is there a better solution somewhere? if(typeof escapeHtmlEntities == ‘undefined’) { escapeHtmlEntities = function (text) { return text.replace(/[\u00A0-\u2666<>\&]/g, function(c) { return ‘&’ + (escapeHtmlEntities.entityTable[c.charCodeAt(0)] || ‘#’+c.charCodeAt(0)) + ‘;’; }); … Read more

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