Why is it not a good idea to dynamically create a lot of symbols in ruby (for versions before 2.2)?

Symbols are like strings but they are immutable – they can’t be modified. They are only put into memory once, making them very efficient to use for things like keys in hashes but they stay in memory until the program exits. This makes them a memory hog if you misuse them. If you dynamically create … Read more

What’s the difference between a string and a symbol in Ruby?

The main difference is that multiple symbols representing a single value are identical whereas this is not true with strings. For example: irb(main):007:0> :test.object_id => 83618 irb(main):008:0> :test.object_id => 83618 irb(main):009:0> :test.object_id => 83618 Those are three references to the symbol :test, which are all the same object. irb(main):010:0> “test”.object_id => -605770378 irb(main):011:0> “test”.object_id => … Read more

in java what does the @ symbol mean?

The @ symbol denotes a Java Annotation. What a Java annotation does, is that it adds a special attribute to the variable, method, class, interface, or other language elements. (This can be configured when you declare the annotation) When you add an annotation to something, other parts of the program can check whether something has … Read more

How to understand symbols in Ruby

Consider this: x = :sym y = :sym (x.__id__ == y.__id__ ) && ( :sym.__id__ == x.__id__) # => true x = “string” y = “string” (x.__id__ == y.__id__ ) || ( “string”.__id__ == x.__id__) # => false So, however you create a symbol object, as long as its contents are the same, it will … Read more

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